



'''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


lowerCamelCase__	  =		threading.Lock()
lowerCamelCase__	  =		None

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

lowerCamelCase__	  =		logging.WARNING

lowerCamelCase__	  =		True





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






							'''simple docstring'''
							_lowercase							:		Optional[int]				=   os.getenv('''DIFFUSERS_VERBOSITY''' ,       snake_case_  )
							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 				_SCREAMING_SNAKE_CASE(					)		->str:






							'''simple docstring'''
							return __name__.split('''.'''  )[0]





def 				_SCREAMING_SNAKE_CASE(					)		->logging.Logger:






							'''simple docstring'''
							return logging.getLogger(_get_library_name()  )





def 				_SCREAMING_SNAKE_CASE(					)		->None:






							'''simple docstring'''
							global _default_handler

							with _lock:
														if _default_handler:
																					# This library has already configured the library root logger.
																					return
														_lowercase							:		Optional[int]				=   logging.StreamHandler()  # Set sys.stderr as stream.
														_lowercase							:		Any				=   sys.stderr.flush

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





def 				_SCREAMING_SNAKE_CASE(					)		->None:






							'''simple docstring'''
							global _default_handler

							with _lock:
														if not _default_handler:
																					return

														_lowercase							:		Dict				=   _get_library_root_logger()
														library_root_logger.removeHandler(_default_handler  )
														library_root_logger.setLevel(logging.NOTSET  )
														_lowercase							:		Tuple				=   None





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






							'''simple docstring'''
							return log_levels





def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     Optional[str] = None  )		->logging.Logger:






							'''simple docstring'''

							if name is None:
														_lowercase							:		str				=   _get_library_name()

							_configure_library_root_logger()
							return logging.getLogger(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					)		->int:






							'''simple docstring'''
							_configure_library_root_logger()
							return _get_library_root_logger().getEffectiveLevel()





def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     int  )		->None:






							'''simple docstring'''
							_configure_library_root_logger()
							_get_library_root_logger().setLevel(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					)		->str:






							'''simple docstring'''
							return set_verbosity(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					)		->Optional[Any]:






							'''simple docstring'''
							return set_verbosity(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					)		->Optional[Any]:






							'''simple docstring'''
							return set_verbosity(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					)		->List[Any]:






							'''simple docstring'''
							return set_verbosity(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					)		->None:






							'''simple docstring'''
							_configure_library_root_logger()

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





def 				_SCREAMING_SNAKE_CASE(					)		->None:






							'''simple docstring'''
							_configure_library_root_logger()

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





def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     logging.Handler  )		->None:






							'''simple docstring'''
							_configure_library_root_logger()

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





def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     logging.Handler  )		->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(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					)		->None:






							'''simple docstring'''
							_configure_library_root_logger()
							_lowercase							:		List[Any]				=   False





def 				_SCREAMING_SNAKE_CASE(					)		->None:






							'''simple docstring'''
							_configure_library_root_logger()
							_lowercase							:		str				=   True





def 				_SCREAMING_SNAKE_CASE(					)		->None:






							'''simple docstring'''
							_lowercase							:		Any				=   _get_library_root_logger().handlers

							for handler in handlers:
														_lowercase							:		Optional[int]				=   logging.Formatter('''[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s'''  )
														handler.setFormatter(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					)		->None:






							'''simple docstring'''
							_lowercase							:		Dict				=   _get_library_root_logger().handlers

							for handler in handlers:
														handler.setFormatter(snake_case_  )





def 				_SCREAMING_SNAKE_CASE(					self    :     Tuple ,       *snake_case_    :     str ,       **snake_case_    :     Tuple  )		->str:






							'''simple docstring'''
							_lowercase							:		str				=   os.getenv('''DIFFUSERS_NO_ADVISORY_WARNINGS''' ,       snake_case_  )
							if no_advisory_warnings:
														return
							self.warning(*snake_case_ ,       **snake_case_  )


lowerCamelCase__	  =		warning_advice

class 	_lowerCAmelCase     :






		'''simple docstring'''
		def __init__(						self							:       Optional[Any]      ,		*UpperCamelCase_							:       Any      ,		**UpperCamelCase_							:       Tuple		)      ->			List[Any]:  # pylint: disable=unused-argument







									'''simple docstring'''





									_lowercase							:		Optional[Any]				=   args[0] if args else None
		def __iter__(						self							:       int		)      ->			List[str]:







									'''simple docstring'''





									return iter(self._iterator		)
		def __getattr__(						self							:       Any      ,		UpperCamelCase_							:       Union[str, Any]		)      ->			int:







									'''simple docstring'''





									def empty_fn(*UpperCamelCase_							:       str      ,		**UpperCamelCase_							:       Dict		):  # pylint: disable=unused-argument
																return

									return empty_fn
		def __enter__(						self							:       str		)      ->			int:







									'''simple docstring'''





									return self





		def __exit__(						self							:       Any      ,		UpperCamelCase_							:       Dict      ,		UpperCamelCase_							:       List[Any]      ,		UpperCamelCase_							:       int		)      ->			List[Any]:







									'''simple docstring'''





									return




class 	_lowerCAmelCase     :






		'''simple docstring'''
		def __call__(						self							:       Dict      ,		*UpperCamelCase_							:       Tuple      ,		**UpperCamelCase_							:       int		)      ->			Optional[Any]:







									'''simple docstring'''





									if _tqdm_active:
																return tqdm_lib.tqdm(*_UpperCAmelCase      ,		**_UpperCAmelCase		)
									else:
																return EmptyTqdm(*_UpperCAmelCase      ,		**_UpperCAmelCase		)
		def 						__lowercase      (						self							:       Optional[int]      ,		*UpperCamelCase_							:       Tuple      ,		**UpperCamelCase_							:       Union[str, Any]		)      ->			Union[str, Any]:







									'''simple docstring'''





									_lowercase							:		Tuple				=   None
									if _tqdm_active:
																return tqdm_lib.tqdm.set_lock(*_UpperCAmelCase      ,		**_UpperCAmelCase		)





		def 						__lowercase      (						self							:       Any		)      ->			Dict:







									'''simple docstring'''





									if _tqdm_active:
																return tqdm_lib.tqdm.get_lock()




lowerCamelCase__	  =		_tqdm_cls()





def 				_SCREAMING_SNAKE_CASE(					)		->bool:






							'''simple docstring'''
							global _tqdm_active
							return bool(_tqdm_active  )





def 				_SCREAMING_SNAKE_CASE(					)		->Any:






							'''simple docstring'''
							global _tqdm_active
							_lowercase							:		int				=   True





def 				_SCREAMING_SNAKE_CASE(					)		->str:






							'''simple docstring'''
							global _tqdm_active
							_lowercase							:		Dict				=   False






from __future__ import annotations





def  _snake_case		(snake_case_					:     str  )							->		bool:
  __UpperCAmelCase	:  int
  __UpperCAmelCase	:  list[str]		=     list(snake_case_  )
  __UpperCAmelCase,			__UpperCAmelCase	:  Any		=     _vector[:-1], int(_vector[-1]  )
  __UpperCAmelCase	:  list[int]		=     [int(snake_case_  ) for digit in __vector]

  vector.reverse()
  for i, digit in enumerate(snake_case_  ):
    if i & 1 == 0:
      __UpperCAmelCase	:  int		=     digit * 2
      if doubled > 9:
        doubled -= 9
      check_digit += doubled
    else:
      check_digit += digit

  return check_digit % 10 == 0


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      assert is_luhn('''79927398713''')
      assert not is_luhn('''79927398714''')





