MCPcopy
hub / github.com/dask/dask / da_frompyfunc

Class da_frompyfunc

dask/array/_array_expr/_ufunc.py:33–65  ·  view source on GitHub ↗

A serializable `frompyfunc` object

Source from the content-addressed store, hash-verified

31
32
33class da_frompyfunc:
34 """A serializable `frompyfunc` object"""
35
36 def __init__(self, func, nin, nout):
37 self._ufunc = np.frompyfunc(func, nin, nout)
38 self._func = func
39 self.nin = nin
40 self.nout = nout
41 self._name = funcname(func)
42 self.__name__ = f"frompyfunc-{self._name}"
43
44 def __repr__(self):
45 return f"da.frompyfunc<{self._name}, {self.nin}, {self.nout}>"
46
47 def __dask_tokenize__(self):
48 return (normalize_token(self._func), self.nin, self.nout)
49
50 def __reduce__(self):
51 return (da_frompyfunc, (self._func, self.nin, self.nout))
52
53 def __call__(self, *args, **kwargs):
54 return self._ufunc(*args, **kwargs)
55
56 def __getattr__(self, a):
57 if not a.startswith("_"):
58 return getattr(self._ufunc, a)
59 raise AttributeError(f"{type(self).__name__!r} object has no attribute {a!r}")
60
61 def __dir__(self):
62 o = set(dir(type(self)))
63 o.update(self.__dict__)
64 o.update(dir(self._ufunc))
65 return list(o)
66
67
68@derived_from(np)

Callers 2

test_frompyfunc_wrapperFunction · 0.90
frompyfuncFunction · 0.70

Calls

no outgoing calls

Tested by 1

test_frompyfunc_wrapperFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…