





from collections.abc import Iterator, MutableMapping
from dataclasses import dataclass
from typing import Generic, TypeVar

lowercase				:	str      						=  TypeVar("""KEY""")
lowercase				:	str      						=  TypeVar("""VAL""")





@dataclass(frozen=__UpperCAmelCase			,  slots=__UpperCAmelCase     )
class 			A__   (							Generic[KEY, VAL]     ):




   """simple docstring"""



   __A       :    KEY
   __A       :    VAL





class 			A__   (							_Item     ):




   """simple docstring"""



   def __init__( self)      ->						None:







          '''simple docstring'''

          super().__init__(lowercase ,  lowercase)

   def __bool__( self)      ->						bool:







          '''simple docstring'''

          return False

lowercase				:	int      						=  _DeletedItem()





class 			A__   (							MutableMapping[KEY, VAL]     ):




   """simple docstring"""



   def __init__( self ,  lowercase = 8 ,  lowercase = 0.75)      ->						None:







          '''simple docstring'''

          a__						:     str			=    initial_block_size
          a__						:     list[_Item | None]			=    [None] * initial_block_size
          assert 0.0 < capacity_factor < 1.0
          a__						:     Dict			=    capacity_factor
          a__						:     str			=    0

   def 							__lowercase		( self ,  lowercase)      ->						int:







          '''simple docstring'''

          return hash(lowercase) % len(self._buckets)

   def 							__lowercase		( self ,  lowercase)      ->						int:







          '''simple docstring'''

          return (ind + 1) % len(self._buckets)

   def 							__lowercase		( self ,  lowercase ,  lowercase ,  lowercase)      ->						bool:







          '''simple docstring'''

          a__						:     List[Any]			=    self._buckets[ind]
          if not stored:
                 a__						:     int			=    _Item(lowercase ,  lowercase)
                 self._len += 1
                 return True
          elif stored.key == key:
                 a__						:     Any			=    _Item(lowercase ,  lowercase)
                 return True
          else:
                 return False

   def 							__lowercase		( self)      ->						bool:







          '''simple docstring'''

          a__						:     List[Any]			=    len(self._buckets) * self._capacity_factor
          return len(self) >= int(lowercase)

   def 							__lowercase		( self)      ->						bool:







          '''simple docstring'''

          if len(self._buckets) <= self._initial_block_size:
                 return False
          a__						:     Union[str, Any]			=    len(self._buckets) * self._capacity_factor / 2
          return len(self) < limit

   def 							__lowercase		( self ,  lowercase)      ->						None:







          '''simple docstring'''

          a__						:     Any			=    self._buckets
          a__						:     Optional[Any]			=    [None] * new_size
          a__						:     Tuple			=    0
          for item in old_buckets:
                 if item:
                        self._add_item(item.key ,  item.val)

   def 							__lowercase		( self)      ->						None:







          '''simple docstring'''

          self._resize(len(self._buckets) * 2)

   def 							__lowercase		( self)      ->						None:







          '''simple docstring'''

          self._resize(len(self._buckets) // 2)

   def 							__lowercase		( self ,  lowercase)      ->						Iterator[int]:







          '''simple docstring'''

          a__						:     Optional[int]			=    self._get_bucket_index(lowercase)
          for _ in range(len(self._buckets)):
                 yield ind
                 a__						:     Any			=    self._get_next_ind(lowercase)

   def 							__lowercase		( self ,  lowercase ,  lowercase)      ->						None:







          '''simple docstring'''

          for ind in self._iterate_buckets(lowercase):
                 if self._try_set(lowercase ,  lowercase ,  lowercase):
                        break

   def __setitem__( self ,  lowercase ,  lowercase)      ->						None:







          '''simple docstring'''

          if self._is_full():
                 self._size_up()

          self._add_item(lowercase ,  lowercase)

   def __delitem__( self ,  lowercase)      ->						None:







          '''simple docstring'''

          for ind in self._iterate_buckets(lowercase):
                 a__						:     Tuple			=    self._buckets[ind]
                 if item is None:
                        raise KeyError(lowercase)
                 if item is _deleted:
                        continue
                 if item.key == key:
                        a__						:     List[str]			=    _deleted
                        self._len -= 1
                        break
          if self._is_sparse():
                 self._size_down()

   def __getitem__( self ,  lowercase)      ->						VAL:







          '''simple docstring'''

          for ind in self._iterate_buckets(lowercase):
                 a__						:     Optional[Any]			=    self._buckets[ind]
                 if item is None:
                        break
                 if item is _deleted:
                        continue
                 if item.key == key:
                        return item.val
          raise KeyError(lowercase)

   def __len__( self)      ->						int:







          '''simple docstring'''

          return self._len

   def __iter__( self)      ->						Iterator[KEY]:







          '''simple docstring'''

          yield from (item.key for item in self._buckets if item)

   def __repr__( self)      ->						str:







          '''simple docstring'''

          a__						:     Any			=    ' ,'.join(
              F'{item.key}: {item.val}' for item in self._buckets if item)
          return F'HashMap({val_string})'









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


lowercase				:	List[str]      						=  {
    """configuration_clip""": [
        """CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """CLIPConfig""",
        """CLIPOnnxConfig""",
        """CLIPTextConfig""",
        """CLIPVisionConfig""",
    ],
    """processing_clip""": ["""CLIPProcessor"""],
    """tokenization_clip""": ["""CLIPTokenizer"""],
}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowercase				:	Tuple      						=  ["""CLIPTokenizerFast"""]

try:
    if not is_vision_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowercase				:	Optional[int]      						=  ["""CLIPFeatureExtractor"""]
    lowercase				:	Union[str, Any]      						=  ["""CLIPImageProcessor"""]

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowercase				:	Dict      						=  [
        """CLIP_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """CLIPModel""",
        """CLIPPreTrainedModel""",
        """CLIPTextModel""",
        """CLIPTextModelWithProjection""",
        """CLIPVisionModel""",
        """CLIPVisionModelWithProjection""",
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowercase				:	List[str]      						=  [
        """TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """TFCLIPModel""",
        """TFCLIPPreTrainedModel""",
        """TFCLIPTextModel""",
        """TFCLIPVisionModel""",
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowercase				:	Any      						=  [
        """FlaxCLIPModel""",
        """FlaxCLIPPreTrainedModel""",
        """FlaxCLIPTextModel""",
        """FlaxCLIPTextPreTrainedModel""",
        """FlaxCLIPVisionModel""",
        """FlaxCLIPVisionPreTrainedModel""",
    ]


if TYPE_CHECKING:
    from .configuration_clip import (
        CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
        CLIPConfig,
        CLIPOnnxConfig,
        CLIPTextConfig,
        CLIPVisionConfig,
    )
    from .processing_clip import CLIPProcessor
    from .tokenization_clip import CLIPTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_clip_fast import CLIPTokenizerFast

    try:
        if not is_vision_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .feature_extraction_clip import CLIPFeatureExtractor
        from .image_processing_clip import CLIPImageProcessor

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_clip import (
            CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
            CLIPModel,
            CLIPPreTrainedModel,
            CLIPTextModel,
            CLIPTextModelWithProjection,
            CLIPVisionModel,
            CLIPVisionModelWithProjection,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_clip import (
            TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFCLIPModel,
            TFCLIPPreTrainedModel,
            TFCLIPTextModel,
            TFCLIPVisionModel,
        )

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_clip import (
            FlaxCLIPModel,
            FlaxCLIPPreTrainedModel,
            FlaxCLIPTextModel,
            FlaxCLIPTextPreTrainedModel,
            FlaxCLIPVisionModel,
            FlaxCLIPVisionPreTrainedModel,
        )


else:
    import sys

    lowercase				:	List[Any]      						=  _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


