




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


UpperCAmelCase_				:     Any     			=						threading.Lock()
UpperCAmelCase_				:     Optional[logging.Handler]     			=						None

UpperCAmelCase_				:     Optional[int]     			=						{
    '''debug''': logging.DEBUG,
    '''info''': logging.INFO,
    '''warning''': logging.WARNING,
    '''error''': logging.ERROR,
    '''critical''': logging.CRITICAL,
}

UpperCAmelCase_				:     List[Any]     			=						logging.WARNING

UpperCAmelCase_				:     Tuple     			=						True







def 	_UpperCamelCase       ()->      int:




     '''simple docstring'''





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




     '''simple docstring'''





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







def 	_UpperCamelCase       ()->      logging.Logger:




     '''simple docstring'''





     return logging.getLogger(_get_library_name()		)







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     global _default_handler

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

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







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     global _default_handler

     with _lock:
          if not _default_handler:
               return

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







def 	_UpperCamelCase       ()->      List[Any]:




     '''simple docstring'''





     return log_levels







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




     '''simple docstring'''





     if name is None:
          __snake_case			    =     _get_library_name()

     _configure_library_root_logger()
     return logging.getLogger(_lowerCamelCase		)







def 	_UpperCamelCase       ()->      int:




     '''simple docstring'''





     _configure_library_root_logger()
     return _get_library_root_logger().getEffectiveLevel()







def 	_UpperCamelCase       (_lowerCamelCase							:   int		)->      None:




     '''simple docstring'''





     _configure_library_root_logger()
     _get_library_root_logger().setLevel(_lowerCamelCase		)







def 	_UpperCamelCase       ()->      List[Any]:




     '''simple docstring'''





     return set_verbosity(_lowerCamelCase		)







def 	_UpperCamelCase       ()->      List[str]:




     '''simple docstring'''





     return set_verbosity(_lowerCamelCase		)







def 	_UpperCamelCase       ()->      Optional[int]:




     '''simple docstring'''





     return set_verbosity(_lowerCamelCase		)







def 	_UpperCamelCase       ()->      Optional[int]:




     '''simple docstring'''





     return set_verbosity(_lowerCamelCase		)







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     _configure_library_root_logger()

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







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     _configure_library_root_logger()

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







def 	_UpperCamelCase       (_lowerCamelCase							:   logging.Handler		)->      None:




     '''simple docstring'''





     _configure_library_root_logger()

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







def 	_UpperCamelCase       (_lowerCamelCase							:   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(_lowerCamelCase		)







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     _configure_library_root_logger()
     __snake_case			    =     False







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     _configure_library_root_logger()
     __snake_case			    =     True







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     __snake_case			    =     _get_library_root_logger().handlers

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







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     __snake_case			    =     _get_library_root_logger().handlers

     for handler in handlers:
          handler.setFormatter(_lowerCamelCase		)







def 	_UpperCamelCase       (self							:   str      ,		*_lowerCamelCase							:   List[Any]      ,		**_lowerCamelCase							:   Optional[int]		)->      Optional[Any]:




     '''simple docstring'''





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


UpperCAmelCase_				:     List[str]     			=						warning_advice





class 			lowerCAmelCase      :


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



            '''simple docstring'''




            __snake_case			    =     args[0] if args else None


       def __iter__(      self     )					->     int:



            '''simple docstring'''




            return iter(self._iterator     )


       def __getattr__(      self			,     __SCREAMING_SNAKE_CASE     )					->     Any:



            '''simple docstring'''




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

            return empty_fn


       def __enter__(      self     )					->     int:



            '''simple docstring'''




            return self




       def __exit__(      self			,     __SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE     )					->     Dict:



            '''simple docstring'''




            return





class 			lowerCAmelCase      :


       def __call__(      self			,     *__SCREAMING_SNAKE_CASE			,     **__SCREAMING_SNAKE_CASE     )					->     Optional[Any]:



            '''simple docstring'''




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


       def 					lowerCAmelCase					(      self			,     *__SCREAMING_SNAKE_CASE			,     **__SCREAMING_SNAKE_CASE     )					->     int:



            '''simple docstring'''




            __snake_case			    =     None
            if _tqdm_active:
                 return tqdm_lib.tqdm.set_lock(*__SCREAMING_SNAKE_CASE			,     **__SCREAMING_SNAKE_CASE     )




       def 					lowerCAmelCase					(      self     )					->     List[str]:



            '''simple docstring'''




            if _tqdm_active:
                 return tqdm_lib.tqdm.get_lock()





UpperCAmelCase_				:     int     			=						_tqdm_cls()







def 	_UpperCamelCase       ()->      bool:




     '''simple docstring'''





     global _tqdm_active
     return bool(_tqdm_active		)







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




     '''simple docstring'''





     global _tqdm_active
     __snake_case			    =     True







def 	_UpperCamelCase       ()->      List[Any]:




     '''simple docstring'''





     global _tqdm_active
     __snake_case			    =     False












'''simple docstring'''



import warnings

from ...utils import logging
from .image_processing_detr import DetrImageProcessor


UpperCAmelCase_				:     Dict     			=						logging.get_logger(__name__)





class 			lowerCAmelCase      (       __lowerCAmelCase):


       def __init__(      self			,     *__SCREAMING_SNAKE_CASE			,     **__SCREAMING_SNAKE_CASE     )					->     None:



            '''simple docstring'''




            warnings.warn(
                '''The class DetrFeatureExtractor is deprecated and will be removed in version 5 of Transformers.'''
                ''' Please use DetrImageProcessor instead.'''			,     __SCREAMING_SNAKE_CASE			,     )
            super().__init__(*__SCREAMING_SNAKE_CASE			,     **__SCREAMING_SNAKE_CASE     )






