MCPcopy
hub / github.com/numpy/numpy / _call_as_normal

Method _call_as_normal

numpy/lib/_function_base_impl.py:2494–2522  ·  view source on GitHub ↗

Return arrays with the results of `pyfunc` broadcast (vectorized) over `args` and `kwargs` not in `excluded`.

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

2492 self.__doc__ = self._doc
2493
2494 def _call_as_normal(self, *args, **kwargs):
2495 """
2496 Return arrays with the results of `pyfunc` broadcast (vectorized) over
2497 `args` and `kwargs` not in `excluded`.
2498 """
2499 excluded = self.excluded
2500 if not kwargs and not excluded:
2501 func = self.pyfunc
2502 vargs = args
2503 else:
2504 # The wrapper accepts only positional arguments: we use `names` and
2505 # `inds` to mutate `the_args` and `kwargs` to pass to the original
2506 # function.
2507 nargs = len(args)
2508
2509 names = [_n for _n in kwargs if _n not in excluded]
2510 inds = [_i for _i in range(nargs) if _i not in excluded]
2511 the_args = list(args)
2512
2513 def func(*vargs):
2514 for _n, _i in enumerate(inds):
2515 the_args[_i] = vargs[_n]
2516 kwargs.update(zip(names, vargs[len(inds):]))
2517 return self.pyfunc(*the_args, **kwargs)
2518
2519 vargs = [args[_i] for _i in inds]
2520 vargs.extend([kwargs[_n] for _n in names])
2521
2522 return self._vectorize_call(func=func, args=vargs)
2523
2524 def __call__(self, *args, **kwargs):
2525 if self.pyfunc is np._NoValue:

Callers 1

__call__Method · 0.95

Calls 1

_vectorize_callMethod · 0.95

Tested by

no test coverage detected