




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


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     __snake_case   (							):


    """simple docstring"""







    UpperCamelCase										=  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     __snake_case   (							):


    """simple docstring"""







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





def     __snake_case   (							):


    """simple docstring"""







    return logging.getLogger(_get_library_name()						)





def     __snake_case   (							):


    """simple docstring"""







    global _default_handler

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

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





def     __snake_case   (							):


    """simple docstring"""







    global _default_handler

    with _lock:
        if not _default_handler:
            return

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





def     __snake_case   (							):


    """simple docstring"""







    return log_levels





def     __snake_case   (							_lowercase = None						):


    """simple docstring"""







    if name is None:
        UpperCamelCase										=  _get_library_name()

    _configure_library_root_logger()
    return logging.getLogger(_lowercase						)





def     __snake_case   (							):


    """simple docstring"""







    _configure_library_root_logger()
    return _get_library_root_logger().getEffectiveLevel()





def     __snake_case   (							_lowercase						):


    """simple docstring"""







    _configure_library_root_logger()
    _get_library_root_logger().setLevel(_lowercase						)





def     __snake_case   (							):


    """simple docstring"""







    return set_verbosity(_lowercase						)





def     __snake_case   (							):


    """simple docstring"""







    return set_verbosity(_lowercase						)





def     __snake_case   (							):


    """simple docstring"""







    return set_verbosity(_lowercase						)





def     __snake_case   (							):


    """simple docstring"""







    return set_verbosity(_lowercase						)





def     __snake_case   (							):


    """simple docstring"""







    _configure_library_root_logger()

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





def     __snake_case   (							):


    """simple docstring"""







    _configure_library_root_logger()

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





def     __snake_case   (							_lowercase						):


    """simple docstring"""







    _configure_library_root_logger()

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





def     __snake_case   (							_lowercase						):


    """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(_lowercase						)





def     __snake_case   (							):


    """simple docstring"""







    _configure_library_root_logger()
    UpperCamelCase										=  False





def     __snake_case   (							):


    """simple docstring"""







    _configure_library_root_logger()
    UpperCamelCase										=  True





def     __snake_case   (							):


    """simple docstring"""







    UpperCamelCase										=  _get_library_root_logger().handlers

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





def     __snake_case   (							):


    """simple docstring"""







    UpperCamelCase										=  _get_library_root_logger().handlers

    for handler in handlers:
        handler.setFormatter(_lowercase						)





def     __snake_case   (							self ,*_lowercase ,**_lowercase						):


    """simple docstring"""







    UpperCamelCase										=  os.getenv('''DIFFUSERS_NO_ADVISORY_WARNINGS''' ,_lowercase						)
    if no_advisory_warnings:
        return
    self.warning(*_lowercase ,**_lowercase						)


SCREAMING_SNAKE_CASE_      =					warning_advice

class 							snake_case_ :







   """simple docstring"""




   def __init__(		self					,				*lowerCamelCase_					,				**lowerCamelCase_)							->      str:  # pylint: disable=unused-argument
       UpperCamelCase										=  args[0] if args else None







   def __iter__(		self)							->      Optional[Any]:
       return iter(self._iterator)







   def __getattr__(		self					,				lowerCamelCase_)							->      List[str]:

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

       return empty_fn







   def __enter__(		self)							->      Optional[Any]:
       return self







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

class 							snake_case_ :







   """simple docstring"""




   def __call__(		self					,				*lowerCamelCase_					,				**lowerCamelCase_)							->      Optional[Any]:
       if _tqdm_active:
           return tqdm_lib.tqdm(*lowerCamelCase_					,				**lowerCamelCase_)
       else:
           return EmptyTqdm(*lowerCamelCase_					,				**lowerCamelCase_)







   def      UpperCAmelCase__ (		self					,				*lowerCamelCase_					,				**lowerCamelCase_)							->      Optional[int]:
       UpperCamelCase										=  None
       if _tqdm_active:
           return tqdm_lib.tqdm.set_lock(*lowerCamelCase_					,				**lowerCamelCase_)







   def      UpperCAmelCase__ (		self)							->      str:
       if _tqdm_active:
           return tqdm_lib.tqdm.get_lock()
SCREAMING_SNAKE_CASE_      =					_tqdm_cls()





def     __snake_case   (							):


    """simple docstring"""







    global _tqdm_active
    return bool(_tqdm_active						)





def     __snake_case   (							):


    """simple docstring"""







    global _tqdm_active
    UpperCamelCase										=  True





def     __snake_case   (							):


    """simple docstring"""







    global _tqdm_active
    UpperCamelCase										=  False





"""simple docstring"""







from math import pi





def     __snake_case   (							_lowercase						):


    """simple docstring"""







    return degree / (180 / pi)


if __name__ == "__main__":
  from doctest import testmod

  testmod()