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

Class da_frompyfunc

dask/array/_array_expr/_ufunc.py:34–66  ·  view source on GitHub ↗

A serializable `frompyfunc` object

Source from the content-addressed store, hash-verified

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