




'''simple docstring'''







# Lint as: python3

import hashlib
from typing import Union






def 		_lowercase		(	lowercase_  ):



		'''simple docstring'''







		if isinstance(__UpperCamelCase						,							__UpperCamelCase  ):
				# Data already in bytes, returns as it as
				return hash_data
		elif isinstance(__UpperCamelCase						,							__UpperCamelCase  ):
				# 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(__UpperCamelCase						,							__UpperCamelCase  ):
				_snake_case	       =       str(__UpperCamelCase  )
		else:
				# If data is not of the required type, raise error
				raise InvalidKeyError(__UpperCamelCase  )

		return hash_data.encode("utf-8"  )





class      lowerCamelCase_							(       __lowerCamelCase							):




					'''simple docstring'''






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





class      lowerCamelCase_							(       __lowerCamelCase							):




					'''simple docstring'''






					def __init__(    self,  __UpperCamelCase,  __UpperCamelCase,  __UpperCamelCase="" ):
							_snake_case	       =       key
							_snake_case	       =       duplicate_key_indices
							_snake_case	       =       fix_msg
							_snake_case	       =       "Found multiple examples generated with the same key"
							if len(_UpperCamelCase ) <= 20:
									_snake_case	       =       f'''\nThe examples at index {', '.join(_UpperCamelCase )} have the key {key}'''
							else:
									_snake_case	       =       f'''\nThe examples at index {', '.join(duplicate_key_indices[:20] )}... ({len(_UpperCamelCase ) - 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_							:




					'''simple docstring'''






					def __init__(    self,  __UpperCamelCase ):
							_snake_case	       =       hashlib.mda(_as_bytes(_UpperCamelCase ) )






					def 				__SCREAMING_SNAKE_CASE	(    self,  __UpperCamelCase ):
							_snake_case	       =       self._split_mda.copy()
							_snake_case	       =       _as_bytes(_UpperCamelCase )
							mda.update(_UpperCamelCase )
							# Convert to integer with hexadecimal conversion
							return int(mda.hexdigest(),  16 )











def 	UpperCAmelCase_    (	__UpperCamelCase	):
    if not isinstance(__UpperCamelCase,				__UpperCamelCase	):
        raise ValueError("""double_factorial() only accepts integral values"""	)
    if n < 0:
        raise ValueError("""double_factorial() not defined for negative values"""	)
    return 1 if n <= 1 else n * double_factorial(n - 2	)


if __name__ == "__main__":
    import doctest

    doctest.testmod()






