MCPcopy Create free account
hub / github.com/apache/arrow / _make_generic_wrapper

Function _make_generic_wrapper

python/pyarrow/compute.py:245–273  ·  view source on GitHub ↗
(func_name, func, options_class, arity)

Source from the content-addressed store, hash-verified

243
244
245def _make_generic_wrapper(func_name, func, options_class, arity):
246 if options_class is None:
247 def wrapper(*args, memory_pool=None):
248 if arity is not Ellipsis and len(args) != arity:
249 raise TypeError(
250 f"{func_name} takes {arity} positional argument(s), "
251 f"but {len(args)} were given"
252 )
253 if args and isinstance(args[0], Expression):
254 return Expression._call(func_name, list(args))
255 return func.call(args, None, memory_pool)
256 else:
257 def wrapper(*args, memory_pool=None, options=None, **kwargs):
258 if arity is not Ellipsis:
259 if len(args) < arity:
260 raise TypeError(
261 f"{func_name} takes {arity} positional argument(s), "
262 f"but {len(args)} were given"
263 )
264 option_args = args[arity:]
265 args = args[:arity]
266 else:
267 option_args = ()
268 options = _handle_options(func_name, options_class, options,
269 option_args, kwargs)
270 if args and isinstance(args[0], Expression):
271 return Expression._call(func_name, list(args), options)
272 return func.call(args, options, memory_pool)
273 return wrapper
274
275
276def _make_signature(arg_names, var_arg_names, options_class):

Callers 1

_wrap_functionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected