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

Function _should_delegate

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

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