

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowercase				      =						{
    """configuration_clipseg""": [
        """CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """CLIPSegConfig""",
        """CLIPSegTextConfig""",
        """CLIPSegVisionConfig""",
    ],
    """processing_clipseg""": ["""CLIPSegProcessor"""],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowercase				      =						[
          """CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """CLIPSegModel""",
          """CLIPSegPreTrainedModel""",
          """CLIPSegTextModel""",
          """CLIPSegVisionModel""",
          """CLIPSegForImageSegmentation""",
      ]

if TYPE_CHECKING:
      from .configuration_clipseg import (
          CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP,
          CLIPSegConfig,
          CLIPSegTextConfig,
          CLIPSegVisionConfig,
      )
      from .processing_clipseg import CLIPSegProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_clipseg import (
                CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST,
                CLIPSegForImageSegmentation,
                CLIPSegModel,
                CLIPSegPreTrainedModel,
                CLIPSegTextModel,
                CLIPSegVisionModel,
            )

else:
      import sys

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








import logging
import os
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


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

__lowercase				      =						logging.WARNING







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      A_							       =		os.getenv('''DATASETS_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 DATASETS_VERBOSITY={env_level_str}, "
                      f"has to be one of: { ', '.join(log_levels.keys()   ) }"   )
      return _default_log_level







def 							_lowerCamelCase   (			):
      '''simple docstring'''







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







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      return logging.getLogger(_get_library_name()   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      A_							       =		_get_library_root_logger()
      library_root_logger.setLevel(_get_default_logging_level()   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      A_							       =		_get_library_root_logger()
      library_root_logger.setLevel(logging.NOTSET   )







def 							_lowerCamelCase   (			SCREAMING_SNAKE_CASE = None   ):
      '''simple docstring'''







      if name is None:
            A_							       =		_get_library_name()
      return logging.getLogger(SCREAMING_SNAKE_CASE   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      return _get_library_root_logger().getEffectiveLevel()







def 							_lowerCamelCase   (			SCREAMING_SNAKE_CASE   ):
      '''simple docstring'''







      _get_library_root_logger().setLevel(SCREAMING_SNAKE_CASE   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      return set_verbosity(SCREAMING_SNAKE_CASE   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      return set_verbosity(SCREAMING_SNAKE_CASE   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      return set_verbosity(SCREAMING_SNAKE_CASE   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      return set_verbosity(SCREAMING_SNAKE_CASE   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      A_							       =		False







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      A_							       =		True


# Configure the library root logger at the module level (singleton-like)
_configure_library_root_logger()

class    _lowercase				:

   def __init__(				self	:    Optional[int]			,						*lowerCamelCase__	:    int			,						**lowerCamelCase__	:    Tuple       ) ->			Dict:  # pylint: disable=unused-argument
         """simple docstring"""





         A_							       =		args[0] if args else None

   def __iter__(				self	:    Optional[int]       ) ->			List[str]:
         """simple docstring"""





         return iter(self._iterator       )

   def __getattr__(				self	:    int			,						lowerCamelCase__	:    List[str]       ) ->			List[str]:
         """simple docstring"""





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

         return empty_fn

   def __enter__(				self	:    Tuple       ) ->			Tuple:
         """simple docstring"""





         return self





   def __exit__(				self	:    Tuple			,						lowerCamelCase__	:    List[Any]			,						lowerCamelCase__	:    List[str]			,						lowerCamelCase__	:    Optional[Any]       ) ->			Optional[int]:
         """simple docstring"""





         return



__lowercase				      =						True

class    _lowercase				:

   def __call__(				self	:    Optional[int]			,						*lowerCamelCase__	:    Optional[int]			,						lowerCamelCase__	:    List[str]=False			,						**lowerCamelCase__	:    Optional[Any]       ) ->			Optional[Any]:
         """simple docstring"""





         if _tqdm_active and not disable:
               return tqdm_lib.tqdm(*lowerCamelCase__			,						**lowerCamelCase__       )
         else:
               return EmptyTqdm(*lowerCamelCase__			,						**lowerCamelCase__       )

   def     UpperCamelCase					(				self	:    Optional[Any]			,						*lowerCamelCase__	:    Any			,						**lowerCamelCase__	:    int       ) ->			str:
         """simple docstring"""





         A_							       =		None
         if _tqdm_active:
               return tqdm_lib.tqdm.set_lock(*lowerCamelCase__			,						**lowerCamelCase__       )





   def     UpperCamelCase					(				self	:    Optional[Any]       ) ->			int:
         """simple docstring"""





         if _tqdm_active:
               return tqdm_lib.tqdm.get_lock()



__lowercase				      =						_tqdm_cls()







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      global _tqdm_active
      return bool(_tqdm_active   )







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      global _tqdm_active
      A_							       =		True







def 							_lowerCamelCase   (			):
      '''simple docstring'''







      global _tqdm_active
      A_							       =		False





