



from ..utils import DummyObject, requires_backends





class 							lowerCAmelCase_		(		metaclass=lowerCamelCase__     ):
		SCREAMING_SNAKE_CASE_       :			Union[str, Any]					       =	["""torch""", """transformers""", """k_diffusion"""]







		def __init__(    self  :   Optional[Any]       ,		*UpperCAmelCase_  :   str       ,		**UpperCAmelCase_  :   Optional[Any]					)       ->		Dict:


						'''simple docstring'''







						requires_backends(self       ,		['''torch''', '''transformers''', '''k_diffusion''']					)







		@classmethod
		def 					a_  (    cls  :   Union[str, Any]       ,		*UpperCAmelCase_  :   List[Any]       ,		**UpperCAmelCase_  :   List[str]					)       ->		Optional[Any]:


						'''simple docstring'''







						requires_backends(cls       ,		['''torch''', '''transformers''', '''k_diffusion''']					)







		@classmethod
		def 					a_  (    cls  :   int       ,		*UpperCAmelCase_  :   Optional[Any]       ,		**UpperCAmelCase_  :   Optional[Any]					)       ->		List[Any]:


						'''simple docstring'''







						requires_backends(cls       ,		['''torch''', '''transformers''', '''k_diffusion''']					)

from hashlib import mda, shaaaa

__snake_case         =     (shaaaa, mda)







class       __snake_case :
 def __init__(	self		, snake_case__ = 8    )						->				None:
       '''simple docstring'''





       UpperCAmelCase     :			str     	=0b0
       UpperCAmelCase     :			str     	=size
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				None:
       '''simple docstring'''





       UpperCAmelCase     :			Union[str, Any]     	=self.hash_(snake_case__    )
       self.bitarray |= h
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				bool:
       '''simple docstring'''





       UpperCAmelCase     :			List[Any]     	=self.hash_(snake_case__    )
       return (h & self.bitarray) == h
 def __contains__(	self		, snake_case__    )						->				bool:
       '''simple docstring'''





       return self.exists(snake_case__    )
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				str:
       '''simple docstring'''





       UpperCAmelCase     :			Dict     	=bin(snake_case__    )[2:]
       return res.zfill(self.size    )
 @property
 def 						UpperCAmelCase__							(	self    )						->				str:
       '''simple docstring'''





       return self.format_bin(self.bitarray    )
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				int:
       '''simple docstring'''





       UpperCAmelCase     :			Union[str, Any]     	=0b0
       for func in HASH_FUNCTIONS:
             UpperCAmelCase     :			Optional[Any]     	=(
                 int.from_bytes(func(value.encode()    ).digest()		, '''little'''    ) % self.size
             )
             res |= 2**position
       return res
 def 						UpperCAmelCase__							(	self		, snake_case__    )						->				str:
       '''simple docstring'''





       return self.format_bin(self.hash_(snake_case__    )    )






 @property
 def 						UpperCAmelCase__							(	self    )						->				float:
       '''simple docstring'''





       UpperCAmelCase     :			int     	=bin(self.bitarray    ).count('''1'''    )
       return (n_ones / self.size) ** len(snake_case__    )
