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

Function divide

dask/array/numpy_compat.py:56–64  ·  view source on GitHub ↗

Implementation of numpy.divide that works with dtype kwarg. Temporary compatibility fix for a bug in numpy's version. See https://github.com/numpy/numpy/issues/3484 for the relevant issue.

(x1, x2, out=None, dtype=None)

Source from the content-addressed store, hash-verified

54except TypeError:
55 # Divide with dtype doesn't work on Python 3
56 def divide(x1, x2, out=None, dtype=None): # type: ignore[misc]
57 """Implementation of numpy.divide that works with dtype kwarg.
58
59 Temporary compatibility fix for a bug in numpy's version. See
60 https://github.com/numpy/numpy/issues/3484 for the relevant issue."""
61 x = np.divide(x1, x2, out)
62 if dtype is not None:
63 x = x.astype(dtype)
64 return x
65
66 ma_divide = np.ma.core._DomainedBinaryOperation(
67 divide, np.ma.core._DomainSafeDivide(), 0, 1 # type: ignore[attr-defined]

Callers

nothing calls this directly

Calls 1

astypeMethod · 0.45

Tested by

no test coverage detected