H

function of dascore.utils.identity source

H(
    domain: str ,
    payload: Any ,
    encoded: bool = False,
)-> ‘str’

Return the 32 character id of a payload within a domain.

Parameters

Parameter Description
domain What kind of thing is being named. Equal payloads in different
domains get different ids.
payload Anything encode can spell.
encoded True if the payload is already a canonical JSON-safe tree, which
skips encoding it; for hot paths which build one themselves.

Examples

from dascore.utils.identity import H
assert H("operation", {"dim": "time"}) == H("operation", {"dim": "time"})
assert H("operation", {"dim": "time"}) != H("operation", {"dim": "distance"})