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

Function asanyarray_safe

dask/array/utils.py:500–511  ·  view source on GitHub ↗

If a is dask.array, return dask.array.asanyarray(a, **kwargs), otherwise return np.asanyarray(a, like=like, **kwargs), dispatching the call to the library that implements the like array. Note that when a is a dask.Array but like isn't, this function will call a.compute(scheduler

(a, like, **kwargs)

Source from the content-addressed store, hash-verified

498
499
500def asanyarray_safe(a, like, **kwargs):
501 """
502 If a is dask.array, return dask.array.asanyarray(a, **kwargs),
503 otherwise return np.asanyarray(a, like=like, **kwargs), dispatching
504 the call to the library that implements the like array. Note that
505 when a is a dask.Array but like isn't, this function will call
506 a.compute(scheduler="sync") before np.asanyarray, as downstream
507 libraries are unlikely to know how to convert a dask.Array.
508 """
509 from dask.array.core import asanyarray
510
511 return _array_like_safe(np.asanyarray, asanyarray, a, like, **kwargs)
512
513
514def validate_axis(axis, ndim):

Callers 2

sanitize_indexFunction · 0.90
asanyarrayFunction · 0.90

Calls 1

_array_like_safeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…