MCPcopy Create free account
hub / github.com/dask/dask / __array__

Method __array__

dask/array/core.py:1709–1731  ·  view source on GitHub ↗
(self, dtype=None, copy=None, **kwargs)

Source from the content-addressed store, hash-verified

1707 __array_priority__ = 11 # higher than numpy.ndarray and numpy.matrix
1708
1709 def __array__(self, dtype=None, copy=None, **kwargs):
1710 if kwargs:
1711 warnings.warn(
1712 f"Extra keyword arguments {kwargs} are ignored and won't be "
1713 "accepted in the future",
1714 FutureWarning,
1715 )
1716 if copy is False:
1717 warnings.warn(
1718 "Can't acquire a memory view of a Dask array. "
1719 "This will raise in the future.",
1720 FutureWarning,
1721 )
1722
1723 x = self.compute()
1724
1725 # Apply requested dtype and convert non-numpy backends to numpy.
1726 # If copy is True, numpy is going to perform its own deep copy
1727 # after this method returns.
1728 # If copy is None, finalize() ensures that the returned object
1729 # does not share memory with an object stored in the graph or on a
1730 # process-local Worker.
1731 return np.asarray(x, dtype=dtype)
1732
1733 def __array_function__(self, func, types, args, kwargs):
1734 import dask.array as module

Callers

nothing calls this directly

Calls 1

computeMethod · 0.95

Tested by

no test coverage detected