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

Function _should_delegate

dask/array/core.py:207–228  ·  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

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…