/usr/local/lib/python3.6/site-packages/datasets/__pycache__
NameSizeModeActions
arrow_dataset.cpython-36.pyc1898500644editdlrm
arrow_reader.cpython-36.pyc224830644editdlrm
arrow_writer.cpython-36.pyc221100644editdlrm
builder.cpython-36.pyc527790644editdlrm
combine.cpython-36.pyc55080644editdlrm
config.cpython-36.pyc51810644editdlrm
dataset_dict.cpython-36.pyc833190644editdlrm
data_files.cpython-36.pyc301530644editdlrm
fingerprint.cpython-36.pyc189790644editdlrm
info.cpython-36.pyc173590644editdlrm
inspect.cpython-36.pyc185830644editdlrm
iterable_dataset.cpython-36.pyc629320644editdlrm
keyhash.cpython-36.pyc33410644editdlrm
load.cpython-36.pyc629220644editdlrm
metric.cpython-36.pyc232170644editdlrm
naming.cpython-36.pyc25710644editdlrm
search.cpython-36.pyc313390644editdlrm
splits.cpython-36.pyc225220644editdlrm
streaming.cpython-36.pyc41190644editdlrm
table.cpython-36.pyc796120644editdlrm
__init__.cpython-36.pyc22820644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/datasets/__pycache__/keyhash.cpython-36.pyc (3341B)
3 <%Eg@sddZddlZddlmZeeeefedddZGdddeZ Gd d d eZ Gd d d Z dS) a Hashing function for dataset keys using `hashlib.md5` Requirements for the hash function: - Provides a uniformly distributed hash from random space - Adequately fast speed - Working with multiple input types (in this case, `str`, `int` or `bytes`) - Should be platform independent (generates same hash on different OS and systems) The hashing function provides a unique 128-bit integer hash of the key provided. The split name is being used here as the hash salt to avoid having same hashes in different splits due to same keys N)Union) hash_datareturncCsLt|tr|St|tr&|jdd}nt|tr:t|}nt||jdS)z| Returns the input hash_data in its bytes form Args: hash_data: the hash salt/key to be converted to bytes \/zutf-8) isinstancebytesstrreplaceintInvalidKeyErrorencode)rr:/usr/local/lib/python3.6/site-packages/datasets/keyhash.py _as_bytes%s    rcs eZdZdZfddZZS)r z6Raises an error when given key is of invalid datatype.csDd|_d|dt||_d|_tj|j|j|jdS)Nz7 FAILURE TO GENERATE DATASET: Invalid key type detectedz Found Key z of type z- Keys should be either str, int or bytes type)prefixtypeerr_msgsuffixsuper__init__)selfr) __class__rrr?szInvalidKeyError.__init__)__name__ __module__ __qualname____doc__r __classcell__rr)rrr <sr cs"eZdZdZdfdd ZZS)DuplicatedKeysErrorz(Raise an error when duplicate key found.cs||_||_||_d|_t|dkr>ddj|d||_n.ddj|dddt|dd||_|rxd|nd |_tj |j|j|jdS) Nz3Found multiple examples generated with the same keyz The examples at index z, z have the key z... (z more) have the key  r) keyduplicate_key_indicesfix_msgrlenjoinrrrr)rr"r#r$)rrrrIs .zDuplicatedKeysError.__init__)r)rrrrrrrr)rrrFsrc@s8eZdZdZedddZeeeefedddZ dS) KeyHasherz,KeyHasher class for providing hash using md5) hash_saltcCstjt||_dS)N)hashlibmd5r _split_md5)rr(rrrrYszKeyHasher.__init__)r"rcCs*|jj}t|}|j|t|jdS)zReturns 128-bits unique hash of input key Args: key: the input key to be hashed (should be str, int or bytes) Returns: 128-bit int hash key)r+copyrupdater hexdigest)rr"r*Zbyte_keyrrrhash\s  zKeyHasher.hashN) rrrrr rrr rr0rrrrr'Vsr') rr)typingrr r rr Exceptionr rr'rrrrs