MCPcopy
hub / github.com/dask/dask / normalize_object

Function normalize_object

dask/tokenize.py:195–216  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

193
194@normalize_token.register(object)
195def normalize_object(o):
196 method = getattr(o, "__dask_tokenize__", None)
197 if method is not None and not isinstance(o, type):
198 return method()
199
200 if type(o) is object:
201 return _normalize_pure_object(o)
202
203 if isinstance(o, type):
204 copyreg._slotnames(o)
205
206 if dataclasses.is_dataclass(o) and not isinstance(o, type):
207 return _normalize_dataclass(o)
208
209 try:
210 return _normalize_pickle(o)
211 except Exception:
212 _maybe_raise_nondeterministic(
213 f"Object {o!r} cannot be deterministically hashed. This likely "
214 "indicates that the object cannot be serialized deterministically."
215 )
216 return uuid.uuid4().hex
217
218
219_seen_objects = set()

Callers 3

_normalize_dataclassFunction · 0.85
normalize_arrayFunction · 0.85

Calls 5

methodFunction · 0.85
_normalize_pure_objectFunction · 0.85
_normalize_dataclassFunction · 0.85
_normalize_pickleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…