MCPcopy
hub / github.com/numpy/numpy / _wrapfunc

Function _wrapfunc

numpy/_core/fromnumeric.py:48–63  ·  view source on GitHub ↗
(obj, method, *args, **kwds)

Source from the content-addressed store, hash-verified

46
47
48def _wrapfunc(obj, method, *args, **kwds):
49 bound = getattr(obj, method, None)
50 if bound is None:
51 return _wrapit(obj, method, *args, **kwds)
52
53 try:
54 return bound(*args, **kwds)
55 except TypeError:
56 # A TypeError occurs if the object does have such a method in its
57 # class, but its signature is not identical to that of NumPy's. This
58 # situation has occurred in the case of a downstream library like
59 # 'pandas'.
60 #
61 # Call _wrapit from within the except clause to ensure a potential
62 # exception has a traceback chain.
63 return _wrapit(obj, method, *args, **kwds)
64
65
66def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):

Callers 15

takeFunction · 0.85
reshapeFunction · 0.85
chooseFunction · 0.85
repeatFunction · 0.85
swapaxesFunction · 0.85
transposeFunction · 0.85
argpartitionFunction · 0.85
argsortFunction · 0.85
argmaxFunction · 0.85
argminFunction · 0.85
searchsortedFunction · 0.85
nonzeroFunction · 0.85

Calls 1

_wrapitFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…