MCPcopy
hub / github.com/dask/dask / unpack_singleton

Function unpack_singleton

dask/array/core.py:4436–4449  ·  view source on GitHub ↗

>>> unpack_singleton([[[[1]]]]) 1 >>> unpack_singleton(np.array(np.datetime64('2000-01-01'))) array('2000-01-01', dtype='datetime64[D]')

(x)

Source from the content-addressed store, hash-verified

4434
4435
4436def unpack_singleton(x):
4437 """
4438
4439 >>> unpack_singleton([[[[1]]]])
4440 1
4441 >>> unpack_singleton(np.array(np.datetime64('2000-01-01')))
4442 array('2000-01-01', dtype='datetime64[D]')
4443 """
4444 while isinstance(x, (list, tuple)):
4445 try:
4446 x = x[0]
4447 except (IndexError, TypeError, KeyError):
4448 break
4449 return x
4450
4451
4452def block(arrays, allow_unknown_chunksizes=False):

Callers 2

finalizeFunction · 0.85
concatenate3Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…