MCPcopy Index your code
hub / github.com/dask/dask / normalize_array

Function normalize_array

dask/tokenize.py:414–430  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

412
413 @normalize_token.register(pa.Array)
414 def normalize_array(arr):
415 buffers = arr.buffers()
416 # pyarrow does something clever when (de)serializing an array that has
417 # an empty validity map: The buffers for the deserialized array will
418 # have `None` instead of the empty validity map.
419 #
420 # We'll replicate that behavior here to ensure we get consistent
421 # tokenization.
422 buffers = arr.buffers()
423 if len(buffers) and buffers[0] is not None and arr.null_count == 0:
424 buffers[0] = None
425
426 return (
427 "pa.Array",
428 normalize_token(arr.type),
429 normalize_token(buffers),
430 )
431
432 @normalize_token.register(pa.Buffer)
433 def normalize_buffer(buf):

Callers

nothing calls this directly

Calls 6

hash_buffer_hexFunction · 0.90
normalize_objectFunction · 0.85
viewMethod · 0.80
joinMethod · 0.45
ravelMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…