






'''simple docstring'''





import functools
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

import huggingface_hub.utils as hf_hub_utils
from tqdm import auto as tqdm_lib


SCREAMING_SNAKE_CASE 							=						threading.Lock()
SCREAMING_SNAKE_CASE 							=						None

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

SCREAMING_SNAKE_CASE 							=						logging.WARNING

SCREAMING_SNAKE_CASE 							=						True

def      _lowerCamelCase	(						)      ->					List[str]:
    _UpperCAmelCase				:      Tuple			  =				os.getenv('''TRANSFORMERS_VERBOSITY'''		,		__A )
    if env_level_str:
        if env_level_str in log_levels:
            return log_levels[env_level_str]
        else:
            logging.getLogger().warning(
                f'''Unknown option TRANSFORMERS_VERBOSITY={env_level_str}, '''
                f'''has to be one of: { ', '.join(log_levels.keys() ) }''' )
    return _default_log_level

def      _lowerCamelCase	(						)      ->					str:
    return __name__.split('''.''' )[0]

def      _lowerCamelCase	(						)      ->					logging.Logger:
    return logging.getLogger(_get_library_name() )

def      _lowerCamelCase	(						)      ->					None:
    global _default_handler

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

        # Apply our default configuration to the library root logger.
        _UpperCAmelCase				:      str			  =				_get_library_root_logger()
        library_root_logger.addHandler(_default_handler )
        library_root_logger.setLevel(_get_default_logging_level() )
        _UpperCAmelCase				:      Union[str, Any]			  =				False

def      _lowerCamelCase	(						)      ->					None:
    global _default_handler

    with _lock:
        if not _default_handler:
            return

        _UpperCAmelCase				:      str			  =				_get_library_root_logger()
        library_root_logger.removeHandler(_default_handler )
        library_root_logger.setLevel(logging.NOTSET )
        _UpperCAmelCase				:      Dict			  =				None

def      _lowerCamelCase	(						)      ->					List[Any]:
    return log_levels

def      _lowerCamelCase	(						__A    :							Optional[str] = None )      ->					logging.Logger:

    if name is None:
        _UpperCAmelCase				:      Tuple			  =				_get_library_name()

    _configure_library_root_logger()
    return logging.getLogger(__A )

def      _lowerCamelCase	(						)      ->					int:
    _configure_library_root_logger()
    return _get_library_root_logger().getEffectiveLevel()

def      _lowerCamelCase	(						__A    :							int )      ->					None:
    _configure_library_root_logger()
    _get_library_root_logger().setLevel(__A )

def      _lowerCamelCase	(						)      ->					Tuple:
    return set_verbosity(__A )

def      _lowerCamelCase	(						)      ->					Any:
    return set_verbosity(__A )

def      _lowerCamelCase	(						)      ->					List[str]:
    return set_verbosity(__A )

def      _lowerCamelCase	(						)      ->					Dict:
    return set_verbosity(__A )

def      _lowerCamelCase	(						)      ->					None:
    _configure_library_root_logger()

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

def      _lowerCamelCase	(						)      ->					None:
    _configure_library_root_logger()

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

def      _lowerCamelCase	(						__A    :							logging.Handler )      ->					None:
    _configure_library_root_logger()

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

def      _lowerCamelCase	(						__A    :							logging.Handler )      ->					None:
    _configure_library_root_logger()

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

def      _lowerCamelCase	(						)      ->					None:
    _configure_library_root_logger()
    _UpperCAmelCase				:      Any			  =				False

def      _lowerCamelCase	(						)      ->					None:
    _configure_library_root_logger()
    _UpperCAmelCase				:      List[str]			  =				True

def      _lowerCamelCase	(						)      ->					None:
    _UpperCAmelCase				:      Optional[Any]			  =				_get_library_root_logger().handlers

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

def      _lowerCamelCase	(						)      ->					None:
    _UpperCAmelCase				:      List[str]			  =				_get_library_root_logger().handlers

    for handler in handlers:
        handler.setFormatter(__A )

def      _lowerCamelCase	(						self    :							Union[str, Any]		,		*__A    :							Dict		,		**__A    :							int )      ->					Optional[Any]:
    _UpperCAmelCase				:      Tuple			  =				os.getenv('''TRANSFORMERS_NO_ADVISORY_WARNINGS'''		,		__A )
    if no_advisory_warnings:
        return
    self.warning(*__A		,		**__A )


SCREAMING_SNAKE_CASE 							=						warning_advice

@functools.lru_cache(__A )
def      _lowerCamelCase	(						self    :							Optional[Any]		,		*__A    :							Optional[int]		,		**__A    :							List[Any] )      ->					List[Any]:
    self.warning(*__A		,		**__A )


SCREAMING_SNAKE_CASE 							=						warning_once
class 							A_    :






 '''simple docstring'''




 def __init__(	self							,  *_A							,  **_A) ->		List[Any]:  # pylint: disable=unused-argument

     """simple docstring"""



     _UpperCAmelCase				:      List[str]			  =				args[0] if args else None


 def __iter__(	self) ->		str:

     """simple docstring"""



     return iter(self._iterator)


 def __getattr__(	self							,  _A) ->		Dict:

     """simple docstring"""



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

     return empty_fn


 def __enter__(	self) ->		Tuple:

     """simple docstring"""



     return self


 def __exit__(	self							,  _A							,  _A							,  _A) ->		Tuple:

     """simple docstring"""



     return



class 							A_    :






 '''simple docstring'''




 def __call__(	self							,  *_A							,  **_A) ->		int:

     """simple docstring"""



     if _tqdm_active:
         return tqdm_lib.tqdm(*_A							,  **_A)
     else:
         return EmptyTqdm(*_A							,  **_A)


 def  snake_case__				(	self							,  *_A							,  **_A) ->		Dict:

     """simple docstring"""



     _UpperCAmelCase				:      str			  =				None
     if _tqdm_active:
         return tqdm_lib.tqdm.set_lock(*_A							,  **_A)


 def  snake_case__				(	self) ->		str:

     """simple docstring"""



     if _tqdm_active:
         return tqdm_lib.tqdm.get_lock()



SCREAMING_SNAKE_CASE 							=						_tqdm_cls()

def      _lowerCamelCase	(						)      ->					bool:
    global _tqdm_active
    return bool(_tqdm_active )

def      _lowerCamelCase	(						)      ->					Dict:
    global _tqdm_active
    _UpperCAmelCase				:      List[str]			  =				True
    hf_hub_utils.enable_progress_bars()


def      _lowerCamelCase	(						)      ->					Dict:
    global _tqdm_active
    _UpperCAmelCase				:      List[str]			  =				False
    hf_hub_utils.disable_progress_bars()












def      _lowerCamelCase	(						__A    :							int )      ->					bool:
    if not isinstance(__A		,		__A ):
        _UpperCAmelCase				:      Tuple			  =				f'''Input value of [number={number}] must be an integer'''
        raise TypeError(__A )
    if number < 0:
        return False
    _UpperCAmelCase				:      List[str]			  =				number * number
    while number > 0:
        if number % 10 != number_square % 10:
            return False
        number //= 10
        number_square //= 10
    return True


if __name__ == "__main__":
  import doctest

  doctest.testmod()




