prefect.utilities.hashing
¶
file_hash
¶
Given a path to a file, produces a stable hash of the file contents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
the path to a file |
required |
hash_algo |
Hash algorithm from hashlib to use. |
_md5
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
a hash of the file contents |
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/utilities/hashing.py
37 38 39 40 41 42 43 44 45 46 47 48 |
|
hash_objects
¶
Attempt to hash objects by dumping to JSON or serializing with cloudpickle.
On failure of both, None
will be returned
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/utilities/hashing.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
stable_hash
¶
Given some arguments, produces a stable 64-bit hash of their contents.
Supports bytes and strings. Strings will be UTF-8 encoded.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args |
Union[str, bytes]
|
Items to include in the hash. |
()
|
hash_algo |
Hash algorithm from hashlib to use. |
_md5
|
Returns:
Type | Description |
---|---|
str
|
A hex hash. |
Source code in /home/runner/work/docs/docs/prefect_source/src/prefect/utilities/hashing.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|