
"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


_a									=				{
    'configuration_flava': [
        'FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'FlavaConfig',
        'FlavaImageCodebookConfig',
        'FlavaImageConfig',
        'FlavaMultimodalConfig',
        'FlavaTextConfig',
    ],
}

try:
    if not is_vision_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _a									=				['FlavaFeatureExtractor']
    _a									=				['FlavaImageProcessor']
    _a									=				['FlavaProcessor']

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _a									=				[
        'FLAVA_PRETRAINED_MODEL_ARCHIVE_LIST',
        'FlavaForPreTraining',
        'FlavaImageCodebook',
        'FlavaImageModel',
        'FlavaModel',
        'FlavaMultimodalModel',
        'FlavaPreTrainedModel',
        'FlavaTextModel',
    ]

if TYPE_CHECKING:
    from .configuration_flava import (
        FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP,
        FlavaConfig,
        FlavaImageCodebookConfig,
        FlavaImageConfig,
        FlavaMultimodalConfig,
        FlavaTextConfig,
    )

    try:
        if not is_vision_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .feature_extraction_flava import FlavaFeatureExtractor
        from .image_processing_flava import FlavaImageProcessor
        from .processing_flava import FlavaProcessor

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flava import (
            FLAVA_PRETRAINED_MODEL_ARCHIVE_LIST,
            FlavaForPreTraining,
            FlavaImageCodebook,
            FlavaImageModel,
            FlavaModel,
            FlavaMultimodalModel,
            FlavaPreTrainedModel,
            FlavaTextModel,
        )

else:
    import sys

    _a									=				_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



'''simple docstring'''

from hashlib import mda, shaaaa

lowerCAmelCase_			:			Union[str, Any]    	=   (shaaaa, mda)





class 				lowercase    :


   def __init__( self					:						Optional[Any] ,		__lowerCAmelCase					:						int = 8)   ->       None:
         lowercase_     			=   0B0
         lowercase_     			=   size


   def __UpperCAmelCase							( self					:						Dict ,		__lowerCAmelCase					:						str)   ->       None:
         lowercase_     			=   self.hash_(__lowerCAmelCase)
         self.bitarray |= h


   def __UpperCAmelCase							( self					:						Union[str, Any] ,		__lowerCAmelCase					:						str)   ->       bool:
         lowercase_     			=   self.hash_(__lowerCAmelCase)
         return (h & self.bitarray) == h


   def __contains__( self					:						str ,		__lowerCAmelCase					:						str)   ->       bool:
         return self.exists(__lowerCAmelCase)


   def __UpperCAmelCase							( self					:						Union[str, Any] ,		__lowerCAmelCase					:						int)   ->       str:
         lowercase_     			=   bin(__lowerCAmelCase)[2:]
         return res.zfill(self.size)


   @property
   def __UpperCAmelCase							( self					:						Dict)   ->       str:
         return self.format_bin(self.bitarray)


   def __UpperCAmelCase							( self					:						Any ,		__lowerCAmelCase					:						str)   ->       int:
         lowercase_     			=   0B0
         for func in HASH_FUNCTIONS:
               lowercase_     			=   (
                   int.from_bytes(func(value.encode()).digest() ,		"little") % self.size
               )
               res |= 2**position
         return res


   def __UpperCAmelCase							( self					:						Union[str, Any] ,		__lowerCAmelCase					:						str)   ->       str:
         return self.format_bin(self.hash_(__lowerCAmelCase))


   @property
   def __UpperCAmelCase							( self					:						str)   ->       float:
         lowercase_     			=   bin(self.bitarray).count("1")
         return (n_ones / self.size) ** len(__lowerCAmelCase)






