serialize

module of dascore.utils source

Canonical serialization and hashing for operation parameters.

Fingerprint mode encodes parameters for hashing: arrays become byte digests and None mapping values are omitted. Document mode preserves serializable values for storage, including arrays as nested lists. Dataframes and Series cannot be encoded in document mode. Callables and other unsupported values are named rather than reconstructed; decoding them raises.

Canonical JSON and BLAKE2b provide stable hashes without Python’s process-salted hash. Dataframes and quantities additionally depend on pandas object hashes and Pint’s short unit format.

Functions

Name Description
canonical_json Return the canonical JSON text of an object.
combine_hashes Return one digest standing for an ordered series of digests.
decode Return the object a document-mode encoding stands for.
digest Return a stable 16 character digest of any encodable object.
encode Return a JSON-safe tree standing for an object.
model_values Return a model’s fields and extras, as the objects they are.