"""simple docstring"""


import logging
import os
import sys
import threading
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

from tqdm import auto as tqdm_lib


a							=threading.Lock()
a							=None

a							={
    'debug': logging.DEBUG,
    'info': logging.INFO,
    'warning': logging.WARNING,
    'error': logging.ERROR,
    'critical': logging.CRITICAL,
}

a							=logging.WARNING

a							=True





def       lowerCamelCase_			( )							-> List[str]:




						'''simple docstring'''



						lowerCamelCase__ =os.getenv("DIFFUSERS_VERBOSITY"       ,   __lowerCAmelCase    )
						if env_level_str:
												if env_level_str in log_levels:
																		return log_levels[env_level_str]
												else:
																		logging.getLogger().warning(
																		    F'''Unknown option DIFFUSERS_VERBOSITY={env_level_str}, '''
																		    F'''has to be one of: { ', '.join(log_levels.keys()    ) }'''    )
						return _default_log_level





def       lowerCamelCase_			( )							-> str:




						'''simple docstring'''



						return __name__.split("."    )[0]





def       lowerCamelCase_			( )							-> logging.Logger:




						'''simple docstring'''



						return logging.getLogger(_get_library_name()    )





def       lowerCamelCase_			( )							-> None:




						'''simple docstring'''



						global _default_handler

						with _lock:
												if _default_handler:
																		# This library has already configured the library root logger.
																		return
												lowerCamelCase__ =logging.StreamHandler()  # Set sys.stderr as stream.
												lowerCamelCase__ =sys.stderr.flush

												# Apply our default configuration to the library root logger.
												lowerCamelCase__ =_get_library_root_logger()
												library_root_logger.addHandler(_default_handler    )
												library_root_logger.setLevel(_get_default_logging_level()    )
												lowerCamelCase__ =False





def       lowerCamelCase_			( )							-> None:




						'''simple docstring'''



						global _default_handler

						with _lock:
												if not _default_handler:
																		return

												lowerCamelCase__ =_get_library_root_logger()
												library_root_logger.removeHandler(_default_handler    )
												library_root_logger.setLevel(logging.NOTSET    )
												lowerCamelCase__ =None





def       lowerCamelCase_			( )							-> Union[str, Any]:




						'''simple docstring'''



						return log_levels





def       lowerCamelCase_			( __lowerCAmelCase = None    )							-> logging.Logger:




						'''simple docstring'''



						if name is None:
												lowerCamelCase__ =_get_library_name()

						_configure_library_root_logger()
						return logging.getLogger(__lowerCAmelCase    )





def       lowerCamelCase_			( )							-> int:




						'''simple docstring'''



						_configure_library_root_logger()
						return _get_library_root_logger().getEffectiveLevel()





def       lowerCamelCase_			( __lowerCAmelCase    )							-> None:




						'''simple docstring'''



						_configure_library_root_logger()
						_get_library_root_logger().setLevel(__lowerCAmelCase    )





def       lowerCamelCase_			( )							-> Dict:




						'''simple docstring'''



						return set_verbosity(__lowerCAmelCase    )





def       lowerCamelCase_			( )							-> int:




						'''simple docstring'''



						return set_verbosity(__lowerCAmelCase    )





def       lowerCamelCase_			( )							-> int:




						'''simple docstring'''



						return set_verbosity(__lowerCAmelCase    )





def       lowerCamelCase_			( )							-> Tuple:




						'''simple docstring'''



						return set_verbosity(__lowerCAmelCase    )





def       lowerCamelCase_			( )							-> None:




						'''simple docstring'''



						_configure_library_root_logger()

						assert _default_handler is not None
						_get_library_root_logger().removeHandler(_default_handler    )





def       lowerCamelCase_			( )							-> None:




						'''simple docstring'''



						_configure_library_root_logger()

						assert _default_handler is not None
						_get_library_root_logger().addHandler(_default_handler    )





def       lowerCamelCase_			( __lowerCAmelCase    )							-> None:




						'''simple docstring'''



						_configure_library_root_logger()

						assert handler is not None
						_get_library_root_logger().addHandler(__lowerCAmelCase    )





def       lowerCamelCase_			( __lowerCAmelCase    )							-> None:




						'''simple docstring'''



						_configure_library_root_logger()

						assert handler is not None and handler not in _get_library_root_logger().handlers
						_get_library_root_logger().removeHandler(__lowerCAmelCase    )





def       lowerCamelCase_			( )							-> None:




						'''simple docstring'''



						_configure_library_root_logger()
						lowerCamelCase__ =False





def       lowerCamelCase_			( )							-> None:




						'''simple docstring'''



						_configure_library_root_logger()
						lowerCamelCase__ =True





def       lowerCamelCase_			( )							-> None:




						'''simple docstring'''



						lowerCamelCase__ =_get_library_root_logger().handlers

						for handler in handlers:
												lowerCamelCase__ =logging.Formatter("[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s"    )
												handler.setFormatter(__lowerCAmelCase    )





def       lowerCamelCase_			( )							-> None:




						'''simple docstring'''



						lowerCamelCase__ =_get_library_root_logger().handlers

						for handler in handlers:
												handler.setFormatter(__lowerCAmelCase    )





def       lowerCamelCase_			( self       ,   *__lowerCAmelCase       ,   **__lowerCAmelCase    )							-> Tuple:




						'''simple docstring'''



						lowerCamelCase__ =os.getenv("DIFFUSERS_NO_ADVISORY_WARNINGS"       ,   __lowerCAmelCase    )
						if no_advisory_warnings:
												return
						self.warning(*__lowerCAmelCase       ,   **__lowerCAmelCase    )


a							=warning_advice






class        __UpperCAmelCase						:

				def __init__(				self     ,			*_lowerCamelCase     ,			**_lowerCamelCase				):  # pylint: disable=unused-argument
										lowerCamelCase__ =args[0] if args else None

				def __iter__(				self				):
										return iter(self._iterator				)

				def __getattr__(				self     ,			_lowerCamelCase				):

										def empty_fn(*_lowerCamelCase     ,			**_lowerCamelCase				):  # pylint: disable=unused-argument
																return

										return empty_fn

				def __enter__(				self				):
										return self






				def __exit__(				self     ,			_lowerCamelCase     ,			_lowerCamelCase     ,			_lowerCamelCase				):
										return






class        __UpperCAmelCase						:

				def __call__(				self     ,			*_lowerCamelCase     ,			**_lowerCamelCase				):
										if _tqdm_active:
																return tqdm_lib.tqdm(*_lowerCamelCase     ,			**_lowerCamelCase				)
										else:
																return EmptyTqdm(*_lowerCamelCase     ,			**_lowerCamelCase				)

				def 		_a     (				self     ,			*_lowerCamelCase     ,			**_lowerCamelCase				):
										lowerCamelCase__ =None
										if _tqdm_active:
																return tqdm_lib.tqdm.set_lock(*_lowerCamelCase     ,			**_lowerCamelCase				)






				def 		_a     (				self				):
										if _tqdm_active:
																return tqdm_lib.tqdm.get_lock()





a							=_tqdm_cls()





def       lowerCamelCase_			( )							-> bool:




						'''simple docstring'''



						global _tqdm_active
						return bool(_tqdm_active    )





def       lowerCamelCase_			( )							-> List[str]:




						'''simple docstring'''



						global _tqdm_active
						lowerCamelCase__ =True





def       lowerCamelCase_			( )							-> Tuple:




						'''simple docstring'''



						global _tqdm_active
						lowerCamelCase__ =False



"""simple docstring"""


from __future__ import annotations

from enum import Enum






class        __UpperCAmelCase						(     __lowerCAmelCase     ):
				A__				:       List[Any]  							=	2_4
				A__				:       List[str]  							=	2_1
				A__				:       List[Any]  							=	1_8
				A__				:       Optional[Any]  							=	1_5
				A__				:       List[Any]  							=	1_2
				A__				:       Optional[int]  							=	9
				A__				:       List[Any]  							=	6
				A__				:       int  							=	3
				A__				:       Optional[int]  							=	2
				A__				:       int  							=	1
				A__				:       Optional[int]  							=	-1
				A__				:       Dict  							=	-2
				A__				:       Optional[Any]  							=	-3
				A__				:       str  							=	-6
				A__				:       Union[str, Any]  							=	-9
				A__				:       Optional[Any]  							=	-1_2
				A__				:       int  							=	-1_5
				A__				:       Union[str, Any]  							=	-1_8
				A__				:       Any  							=	-2_1
				A__				:       Union[str, Any]  							=	-2_4






class        __UpperCAmelCase						(     __lowerCAmelCase     ):
				A__				:       Optional[int]  							=	8
				A__				:       Any  							=	7
				A__				:       Any  							=	6
				A__				:       Tuple  							=	5
				A__				:       Optional[Any]  							=	4
				A__				:       str  							=	3
				A__				:       Dict  							=	2
				A__				:       Tuple  							=	1





def       lowerCamelCase_			( __lowerCAmelCase       ,   __lowerCAmelCase       ,   __lowerCAmelCase       ,   )							-> float:




						'''simple docstring'''



						if isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ):
												lowerCamelCase__ =SIUnit[known_prefix.lower()]
						if isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ):
												lowerCamelCase__ =SIUnit[unknown_prefix.lower()]
						lowerCamelCase__ =known_amount * (
						    10 ** (known_prefix.value - unknown_prefix.value)
						)
						return unknown_amount





def       lowerCamelCase_			( __lowerCAmelCase       ,   __lowerCAmelCase       ,   __lowerCAmelCase       ,   )							-> float:




						'''simple docstring'''



						if isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ):
												lowerCamelCase__ =BinaryUnit[known_prefix.lower()]
						if isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ):
												lowerCamelCase__ =BinaryUnit[unknown_prefix.lower()]
						lowerCamelCase__ =known_amount * (
						    2 ** ((known_prefix.value - unknown_prefix.value) * 10)
						)
						return unknown_amount


if __name__ == "__main__":
	import doctest

	doctest.testmod()


