




"""simple docstring"""







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__A   :  int					=      {
    'configuration_x_clip': [
        'XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'XCLIPConfig',
        'XCLIPTextConfig',
        'XCLIPVisionConfig',
    ],
    'processing_x_clip': ['XCLIPProcessor'],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						__A   :  List[str]					=      [
						    'XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'XCLIPModel',
						    'XCLIPPreTrainedModel',
						    'XCLIPTextModel',
						    'XCLIPVisionModel',
						]

if TYPE_CHECKING:
						from .configuration_x_clip import (
						    XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    XCLIPConfig,
						    XCLIPTextConfig,
						    XCLIPVisionConfig,
						)
						from .processing_x_clip import XCLIPProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_x_clip import (
												    XCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
												    XCLIPModel,
												    XCLIPPreTrainedModel,
												    XCLIPTextModel,
												    XCLIPVisionModel,
												)

else:
						import sys

						__A   :  Any					=      _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)






"""simple docstring"""







from collections import deque

from .hash_table import HashTable




class       lowerCAmelCase__       (			lowerCAmelCase_    ):


				"""simple docstring"""





				def __init__(     self					:	Optional[int]    ,   *lowercase__					:	Any    ,   **lowercase__					:	Union[str, Any]						):
						super().__init__(*lowercase__    ,   **lowercase__						)



				def       snake_case    (     self					:	Any    ,   lowercase__					:	Dict    ,   lowercase__					:	Dict						):
						__lowercase				:		Dict												=				deque([]						) if self.values[key] is None else self.values[key]
						self.values[key].appendleft(lowercase__						)
						__lowercase				:		Union[str, Any]												=				self.values[key]



				def       snake_case    (     self					:	str						):
						return (
						    sum(self.charge_factor - len(lowercase__						) for slot in self.values						)
						    / self.size_table
						    * self.charge_factor
						)



				def       snake_case    (     self					:	Union[str, Any]    ,   lowercase__					:	List[str]    ,   lowercase__					:	str=None						):
						if not (
						    len(self.values[key]						) == self.charge_factor and self.values.count(lowercase__						) == 0
						):
								return key
						return super()._collision_resolution(lowercase__    ,   lowercase__						)
