MCPcopy Create free account
hub / github.com/numpy/numpy / _wrapfunc

Function _wrapfunc

numpy/core/fromnumeric.py:53–68  ·  view source on GitHub ↗
(obj, method, *args, **kwds)

Source from the content-addressed store, hash-verified

51
52
53def _wrapfunc(obj, method, *args, **kwds):
54 bound = getattr(obj, method, None)
55 if bound is None:
56 return _wrapit(obj, method, *args, **kwds)
57
58 try:
59 return bound(*args, **kwds)
60 except TypeError:
61 # A TypeError occurs if the object does have such a method in its
62 # class, but its signature is not identical to that of NumPy's. This
63 # situation has occurred in the case of a downstream library like
64 # 'pandas'.
65 #
66 # Call _wrapit from within the except clause to ensure a potential
67 # exception has a traceback chain.
68 return _wrapit(obj, method, *args, **kwds)
69
70
71def _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