






"""simple docstring"""





from .hash_table import HashTable
from .number_theory.prime_numbers import is_prime, next_prime







class 						_a  (		lowercase_       ):





   '''simple docstring'''






   def __init__(       self					, *UpperCAmelCase_					, **UpperCAmelCase_)			->   Tuple:




          '''simple docstring'''




          super().__init__(*UpperCAmelCase_					, **UpperCAmelCase_)





   def __lowercase							(       self					, UpperCAmelCase_					, UpperCAmelCase_)			->   Dict:




          '''simple docstring'''




          lowercase__:							Union[str, Any]         =     (
              next_prime(value % self.size_table)
              if not is_prime(value % self.size_table)
              else value % self.size_table
          )  # gt = bigger than
          return next_prime_gt - (data % next_prime_gt)





   def __lowercase							(       self					, UpperCAmelCase_					, UpperCAmelCase_					, UpperCAmelCase_)			->   Union[str, Any]:




          '''simple docstring'''




          return (increment * self.__hash_function_a(UpperCAmelCase_					, UpperCAmelCase_)) % self.size_table





   def __lowercase							(       self					, UpperCAmelCase_					, UpperCAmelCase_=None)			->   Union[str, Any]:




          '''simple docstring'''




          lowercase__:							str         =     1
          lowercase__:							List[str]         =     self.hash_function(UpperCAmelCase_)

          while self.values[new_key] is not None and self.values[new_key] != key:
                 lowercase__:							int         =     (
                     self.__hash_double_function(UpperCAmelCase_					, UpperCAmelCase_					, UpperCAmelCase_)
                     if self.balanced_factor() >= self.lim_charge
                     else None
                 )
                 if new_key is None:
                        break
                 else:
                        i += 1

          return new_key














'''simple docstring'''


from typing import TYPE_CHECKING

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


lowerCamelCase_					:			Any     						=				{
    '''configuration_sam''': [
        '''SAM_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''SamConfig''',
        '''SamMaskDecoderConfig''',
        '''SamPromptEncoderConfig''',
        '''SamVisionConfig''',
    ],
    '''processing_sam''': ['''SamProcessor'''],
}


try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_					:			Union[str, Any]     						=				[
					    '''SAM_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''SamModel''',
					    '''SamPreTrainedModel''',
					]
try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_					:			Optional[Any]     						=				[
					    '''TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''TFSamModel''',
					    '''TFSamPreTrainedModel''',
					]
try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_					:			Optional[Any]     						=				['''SamImageProcessor''']


if TYPE_CHECKING:
					from .configuration_sam import (
					    SAM_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    SamConfig,
					    SamMaskDecoderConfig,
					    SamPromptEncoderConfig,
					    SamVisionConfig,
					)
					from .processing_sam import SamProcessor

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_sam import SAM_PRETRAINED_MODEL_ARCHIVE_LIST, SamModel, SamPreTrainedModel

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_sam import TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST, TFSamModel, TFSamPreTrainedModel

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .image_processing_sam import SamImageProcessor

else:
					import sys

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