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

Function _copy_func

numpy/core/tests/test_overrides.py:749–755  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

747 import functools
748
749 def _copy_func(f):
750 # Based on http://stackoverflow.com/a/6528148/190597 (Glenn Maynard)
751 g = types.FunctionType(f.__code__, f.__globals__, name=f.__name__,
752 argdefs=f.__defaults__, closure=f.__closure__)
753 g = functools.update_wrapper(g, f)
754 g.__kwdefaults__ = f.__kwdefaults__
755 return g
756
757 trapezoid = _copy_func(np.trapz)
758

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected