




import hashlib
from typing import Union







def 			_UpperCamelCase (_lowerCamelCase							:     Union[str, int, bytes]	)->   bytes:




     '''simple docstring'''





     if isinstance(_lowerCamelCase   ,	_lowerCamelCase	):
          # Data already in bytes, returns as it as
          return hash_data
     elif isinstance(_lowerCamelCase   ,	_lowerCamelCase	):
          # We keep the data as it as for it ot be later encoded to UTF-8
          # However replace `\\` with `/` for Windows compatibility
          __snake_case    					=  hash_data.replace('''\\'''   ,	'''/'''	)
     elif isinstance(_lowerCamelCase   ,	_lowerCamelCase	):
          __snake_case    					=  str(_lowerCamelCase	)
     else:
          # If data is not of the required type, raise error
          raise InvalidKeyError(_lowerCamelCase	)

     return hash_data.encode('''utf-8'''	)





class     lowerCAmelCase   ( __lowerCAmelCase):


       def __init__(   self    ,  __SCREAMING_SNAKE_CASE  )      ->  str:



            '''simple docstring'''




            __snake_case    					=  '''\nFAILURE TO GENERATE DATASET: Invalid key type detected'''
            __snake_case    					=  F'''\nFound Key {hash_data} of type {type(__SCREAMING_SNAKE_CASE  )}'''
            __snake_case    					=  '''\nKeys should be either str, int or bytes type'''
            super().__init__(F'''{self.prefix}{self.err_msg}{self.suffix}'''  )





class     lowerCAmelCase   ( __lowerCAmelCase):


       def __init__(   self    ,  __SCREAMING_SNAKE_CASE    ,  __SCREAMING_SNAKE_CASE    ,  __SCREAMING_SNAKE_CASE=""  )      ->  List[str]:



            '''simple docstring'''




            __snake_case    					=  key
            __snake_case    					=  duplicate_key_indices
            __snake_case    					=  fix_msg
            __snake_case    					=  '''Found multiple examples generated with the same key'''
            if len(__SCREAMING_SNAKE_CASE  ) <= 20:
                 __snake_case    					=  F'''\nThe examples at index {", ".join(__SCREAMING_SNAKE_CASE  )} have the key {key}'''
            else:
                 __snake_case    					=  F'''\nThe examples at index {", ".join(duplicate_key_indices[:20]  )}... ({len(__SCREAMING_SNAKE_CASE  ) - 20} more) have the key {key}'''
            __snake_case    					=  '''\n''' + fix_msg if fix_msg else ''''''
            super().__init__(F'''{self.prefix}{self.err_msg}{self.suffix}'''  )





class     lowerCAmelCase   :


       def __init__(   self    ,  __SCREAMING_SNAKE_CASE  )      ->  Any:



            '''simple docstring'''




            __snake_case    					=  hashlib.mda(_as_bytes(__SCREAMING_SNAKE_CASE  )  )




       def       lowerCAmelCase      (   self    ,  __SCREAMING_SNAKE_CASE  )      ->  int:



            '''simple docstring'''




            __snake_case    					=  self._split_mda.copy()
            __snake_case    					=  _as_bytes(__SCREAMING_SNAKE_CASE  )
            mda.update(__SCREAMING_SNAKE_CASE  )
            # Convert to integer with hexadecimal conversion
            return int(mda.hexdigest()    ,  16  )












'''simple docstring'''



from transformers import ProcessorMixin





class     lowerCAmelCase   ( __lowerCAmelCase):
       __lowercase  :      Union[str, Any]        =			'''AutoFeatureExtractor'''
       __lowercase  :      List[Any]        =			'''AutoTokenizer'''






