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

Class da_frompyfunc

dask/array/ufunc.py:30–62  ·  view source on GitHub ↗

A serializable `frompyfunc` object

Source from the content-addressed store, hash-verified

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

Callers 1

frompyfuncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected