code: 
  
  
  
  
  
  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
  
  
  _UpperCamelCase       = threading.Lock()
  _UpperCamelCase       = None
  
  _UpperCamelCase       = {
      '''debug''': logging.DEBUG,
      '''info''': logging.INFO,
      '''warning''': logging.WARNING,
      '''error''': logging.ERROR,
      '''critical''': logging.CRITICAL,
  }
  
  _UpperCamelCase       = logging.WARNING
  
  _UpperCamelCase       = True
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    Dict:
    __snake_case   :				List[str]        =       os.getenv("DIFFUSERS_VERBOSITY"   ,     lowercase				)
    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:
    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
      __snake_case   :				Optional[int]        =       logging.StreamHandler()  # Set sys.stderr as stream.
      __snake_case   :				Union[str, Any]        =       sys.stderr.flush
  
      # Apply our default configuration to the library root logger.
      __snake_case   :				Optional[int]        =       _get_library_root_logger()
      library_root_logger.addHandler(_default_handler				)
      library_root_logger.setLevel(_get_default_logging_level()				)
      __snake_case   :				Optional[Any]        =       False
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    None:
    global _default_handler
  
    with _lock:
      if not _default_handler:
        return
  
      __snake_case   :				Optional[int]        =       _get_library_root_logger()
      library_root_logger.removeHandler(_default_handler				)
      library_root_logger.setLevel(logging.NOTSET				)
      __snake_case   :				Tuple        =       None
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    List[str]:
    return log_levels
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	lowercase       :    Optional[str] = None				) ->    logging.Logger:
  
    if name is None:
      __snake_case   :				Optional[int]        =       _get_library_name()
  
    _configure_library_root_logger()
    return logging.getLogger(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    int:
    _configure_library_root_logger()
    return _get_library_root_logger().getEffectiveLevel()
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	lowercase       :    int				) ->    None:
    _configure_library_root_logger()
    _get_library_root_logger().setLevel(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    Optional[Any]:
    return set_verbosity(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    int:
    return set_verbosity(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    Optional[Any]:
    return set_verbosity(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    Optional[int]:
    return set_verbosity(lowercase				)
  
  
  
  
  
  
  
  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__(	lowercase       :    logging.Handler				) ->    None:
    _configure_library_root_logger()
  
    assert handler is not None
    _get_library_root_logger().addHandler(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	lowercase       :    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(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    None:
    _configure_library_root_logger()
    __snake_case   :				Dict        =       False
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    None:
    _configure_library_root_logger()
    __snake_case   :				str        =       True
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    None:
    __snake_case   :				Union[str, Any]        =       _get_library_root_logger().handlers
  
    for handler in handlers:
      __snake_case   :				Any        =       logging.Formatter("[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s"				)
      handler.setFormatter(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    None:
    __snake_case   :				str        =       _get_library_root_logger().handlers
  
    for handler in handlers:
      handler.setFormatter(lowercase				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	self       :    List[str]   ,     *lowercase       :    Union[str, Any]   ,     **lowercase       :    Optional[Any]				) ->    Optional[int]:
    __snake_case   :				int        =       os.getenv("DIFFUSERS_NO_ADVISORY_WARNINGS"   ,     lowercase				)
    if no_advisory_warnings:
      return
    self.warning(*lowercase   ,     **lowercase				)
  
  
  _UpperCamelCase       = warning_advice
  
  
  
  
  class 				_lowerCamelCase :
  
  
  
        """simple docstring"""
  
  
  
  
  
  
        def __init__( self				,						*UpperCAmelCase				,						**UpperCAmelCase   )       ->   int:  # pylint: disable=unused-argument
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          __snake_case   :				Any        =       args[0] if args else None
  
  
  
  
  
  
  
        def __iter__( self   )       ->   str:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          return iter(self._iterator   )
  
  
  
  
  
  
  
        def __getattr__( self				,						UpperCAmelCase   )       ->   List[Any]:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          def empty_fn(*UpperCAmelCase				,						**UpperCAmelCase   ):  # pylint: disable=unused-argument
            return
  
          return empty_fn
  
  
  
  
  
  
  
        def __enter__( self   )       ->   Optional[int]:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          return self
  
  
  
  
  
  
  
        def __exit__( self				,						UpperCAmelCase				,						UpperCAmelCase				,						UpperCAmelCase   )       ->   List[Any]:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          return
  
  
  
  
  class 				_lowerCamelCase :
  
  
  
        """simple docstring"""
  
  
  
  
  
  
        def __call__( self				,						*UpperCAmelCase				,						**UpperCAmelCase   )       ->   Optional[int]:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          if _tqdm_active:
            return tqdm_lib.tqdm(*UpperCAmelCase				,						**UpperCAmelCase   )
          else:
            return EmptyTqdm(*UpperCAmelCase				,						**UpperCAmelCase   )
  
  
  
  
  
  
  
        def 						UpperCAmelCase		( self				,						*UpperCAmelCase				,						**UpperCAmelCase   )       ->   Optional[Any]:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          __snake_case   :				Union[str, Any]        =       None
          if _tqdm_active:
            return tqdm_lib.tqdm.set_lock(*UpperCAmelCase				,						**UpperCAmelCase   )
  
  
  
  
  
  
  
        def 						UpperCAmelCase		( self   )       ->   Dict:
  
  
  
  
  
  
          '''simple docstring'''
  
  
  
  
  
  
          if _tqdm_active:
            return tqdm_lib.tqdm.get_lock()
  
  
  
  
  _UpperCamelCase       = _tqdm_cls()
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    bool:
    global _tqdm_active
    return bool(_tqdm_active				)
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    List[Any]:
    global _tqdm_active
    __snake_case   :				Tuple        =       True
  
  
  
  
  
  
  
  def       lowerCAmelCase__(	) ->    Optional[Any]:
    global _tqdm_active
    __snake_case   :				List[Any]        =       False
  
  
style_context: 
  
  
  
  
  
  def       lowerCAmelCase__(	lowercase       :    str				) ->    int:
    __snake_case   :				List[str]        =       str(lowercase				).strip()
    if not oct_string:
      raise ValueError("Empty string was passed to the function"				)
    __snake_case   :				int        =       oct_string[0] == "-"
    if is_negative:
      __snake_case   :				Union[str, Any]        =       oct_string[1:]
    if not oct_string.isdigit() or not all(0 <= int(lowercase				) <= 7 for char in oct_string				):
      raise ValueError("Non-octal value was passed to the function"				)
    __snake_case   :				List[Any]        =       0
    for char in oct_string:
      __snake_case   :				Optional[Any]        =       8 * decimal_number + int(lowercase				)
    if is_negative:
      __snake_case   :				Any        =       -decimal_number
    return decimal_number
  
  
  if __name__ == "__main__":
       from doctest import testmod
  
       testmod()
  
  