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

Function _should_delegate

dask/array/core.py:202–223  ·  view source on GitHub ↗

Check whether Dask should delegate to the other. This implementation follows NEP-13: https://numpy.org/neps/nep-0013-ufunc-overrides.html#behavior-in-combination-with-python-s-binary-operations

(self, other)

Source from the content-addressed store, hash-verified

200
201
202def _should_delegate(self, other) -> bool:
203 """Check whether Dask should delegate to the other.
204 This implementation follows NEP-13:
205 https://numpy.org/neps/nep-0013-ufunc-overrides.html#behavior-in-combination-with-python-s-binary-operations
206 """
207 if hasattr(other, "__array_ufunc__") and other.__array_ufunc__ is None:
208 return True
209 elif (
210 hasattr(other, "__array_ufunc__")
211 and not is_valid_array_chunk(other)
212 # don't delegate to our own parent classes
213 and not isinstance(self, type(other))
214 and type(self) is not type(other)
215 ):
216 return True
217 elif (
218 not hasattr(other, "__array_ufunc__")
219 and hasattr(other, "__array_priority__")
220 and other.__array_priority__ > self.__array_priority__
221 ):
222 return True
223 return False
224
225
226def check_if_handled_given_other(f):

Callers 3

__array_ufunc__Method · 0.90
wrapperFunction · 0.85
__array_ufunc__Method · 0.85

Calls 1

is_valid_array_chunkFunction · 0.90

Tested by

no test coverage detected