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)
| 205 | |
| 206 | |
| 207 | def _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 | |
| 231 | def check_if_handled_given_other(f): |
no test coverage detected
searching dependent graphs…