

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


__A						       =      threading.Lock()
__A						       =      None

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

__A						       =      logging.WARNING

__A						       =      True






def    a__   (   )     ->     Dict:
  __lowerCAmelCase:	List[str]   				=      os.getenv("TRANSFORMERS_VERBOSITY" ,			__SCREAMING_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 TRANSFORMERS_VERBOSITY={env_level_str}, "
          F"has to be one of: { ', '.join(log_levels.keys()			) }"			)
  return _default_log_level






def    a__   (   )     ->     str:
  return __name__.split("."			)[0]






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






def    a__   (   )     ->     None:
  global _default_handler

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

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






def    a__   (   )     ->     None:
  global _default_handler

  with _lock:
    if not _default_handler:
      return

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






def    a__   (   )     ->     int:
  return log_levels






def    a__   (   __SCREAMING_SNAKE_CASE = None			)     ->     logging.Logger:

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

  _configure_library_root_logger()
  return logging.getLogger(__SCREAMING_SNAKE_CASE			)






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






def    a__   (   __SCREAMING_SNAKE_CASE			)     ->     None:
  _configure_library_root_logger()
  _get_library_root_logger().setLevel(__SCREAMING_SNAKE_CASE			)






def    a__   (   )     ->     Any:
  return set_verbosity(__SCREAMING_SNAKE_CASE			)






def    a__   (   )     ->     Dict:
  return set_verbosity(__SCREAMING_SNAKE_CASE			)






def    a__   (   )     ->     str:
  return set_verbosity(__SCREAMING_SNAKE_CASE			)






def    a__   (   )     ->     Union[str, Any]:
  return set_verbosity(__SCREAMING_SNAKE_CASE			)






def    a__   (   )     ->     None:
  _configure_library_root_logger()

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






def    a__   (   )     ->     None:
  _configure_library_root_logger()

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






def    a__   (   __SCREAMING_SNAKE_CASE			)     ->     None:
  _configure_library_root_logger()

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






def    a__   (   __SCREAMING_SNAKE_CASE			)     ->     None:
  _configure_library_root_logger()

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






def    a__   (   )     ->     None:
  _configure_library_root_logger()
  __lowerCAmelCase:	Optional[Any]   				=      False






def    a__   (   )     ->     None:
  _configure_library_root_logger()
  __lowerCAmelCase:	Union[str, Any]   				=      True






def    a__   (   )     ->     None:
  __lowerCAmelCase:	Any   				=      _get_library_root_logger().handlers

  for handler in handlers:
    __lowerCAmelCase:	str   				=      logging.Formatter("[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s"			)
    handler.setFormatter(__SCREAMING_SNAKE_CASE			)






def    a__   (   )     ->     None:
  __lowerCAmelCase:	List[str]   				=      _get_library_root_logger().handlers

  for handler in handlers:
    handler.setFormatter(__SCREAMING_SNAKE_CASE			)






def    a__   (   self ,			*__SCREAMING_SNAKE_CASE ,			**__SCREAMING_SNAKE_CASE			)     ->     Any:
  __lowerCAmelCase:	Any   				=      os.getenv("TRANSFORMERS_NO_ADVISORY_WARNINGS" ,			__SCREAMING_SNAKE_CASE			)
  if no_advisory_warnings:
    return
  self.warning(*__SCREAMING_SNAKE_CASE ,			**__SCREAMING_SNAKE_CASE			)


__A						       =      warning_advice






@functools.lru_cache(__SCREAMING_SNAKE_CASE			)
def    a__   (   self ,			*__SCREAMING_SNAKE_CASE ,			**__SCREAMING_SNAKE_CASE			)     ->     List[str]:
  self.warning(*__SCREAMING_SNAKE_CASE ,			**__SCREAMING_SNAKE_CASE			)


__A						       =      warning_once





class    snake_case     :

    def __init__(     self							:    Optional[int]					,  *UpperCamelCase__							:    Tuple					,  **UpperCamelCase__							:    str)->       Union[str, Any]:  # pylint: disable=unused-argument



      '''simple docstring'''


      __lowerCAmelCase:	Dict   				=      args[0] if args else None

    def __iter__(     self							:    Optional[Any])->       int:



      '''simple docstring'''


      return iter(self._iterator)

    def __getattr__(     self							:    Tuple					,  UpperCamelCase__							:    Tuple)->       int:



      '''simple docstring'''


      def empty_fn(*UpperCamelCase__							:    str					,  **UpperCamelCase__							:    List[Any]):  # pylint: disable=unused-argument
        return

      return empty_fn

    def __enter__(     self							:    Dict)->       List[str]:



      '''simple docstring'''


      return self




    def __exit__(     self							:    List[str]					,  UpperCamelCase__							:    Any					,  UpperCamelCase__							:    Optional[Any]					,  UpperCamelCase__							:    Dict)->       str:



      '''simple docstring'''


      return





class    snake_case     :

    def __call__(     self							:    List[str]					,  *UpperCamelCase__							:    List[Any]					,  **UpperCamelCase__							:    Union[str, Any])->       str:



      '''simple docstring'''


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

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



      '''simple docstring'''


      __lowerCAmelCase:	Union[str, Any]   				=      None
      if _tqdm_active:
        return tqdm_lib.tqdm.set_lock(*UpperCamelCase__					,  **UpperCamelCase__)




    def 							lowercase_					(     self							:    Tuple)->       List[Any]:



      '''simple docstring'''


      if _tqdm_active:
        return tqdm_lib.tqdm.get_lock()


__A						       =      _tqdm_cls()






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






def    a__   (   )     ->     Dict:
  global _tqdm_active
  __lowerCAmelCase:	Union[str, Any]   				=      True
  hf_hub_utils.enable_progress_bars()






def    a__   (   )     ->     int:
  global _tqdm_active
  __lowerCAmelCase:	str   				=      False
  hf_hub_utils.disable_progress_bars()





"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__A						       =      {
    "configuration_swinv2": ["SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Swinv2Config"],
}


try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			__A						       =      [
			    "SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "Swinv2ForImageClassification",
			    "Swinv2ForMaskedImageModeling",
			    "Swinv2Model",
			    "Swinv2PreTrainedModel",
			]


if TYPE_CHECKING:
			from .configuration_swinva import SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP, SwinvaConfig

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_swinva import (
						    SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST,
						    SwinvaForImageClassification,
						    SwinvaForMaskedImageModeling,
						    SwinvaModel,
						    SwinvaPreTrainedModel,
						)


else:
			import sys

			__A						       =      _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


