MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / wrapper

Function wrapper

python/paddle/utils/decorator_utils.py:176–186  ·  view source on GitHub ↗
(*args: _InputT.args, **kwargs: _InputT.kwargs)

Source from the content-addressed store, hash-verified

174 def decorator(func: Callable[_InputT, _RetT]) -> Callable[_InputT, _RetT]:
175 @functools.wraps(func)
176 def wrapper(*args: _InputT.args, **kwargs: _InputT.kwargs) -> _RetT:
177 if not kwargs:
178 return func(*args, **kwargs)
179 if alias_list[1] in kwargs:
180 if alias_list[0] not in kwargs:
181 kwargs[alias_list[0]] = kwargs.pop(alias_list[1])
182 else:
183 raise ValueError(
184 f"Cannot specify both '{alias_list[0]}' and its alias '{alias_list[1]}'"
185 )
186 return func(*args, **kwargs)
187
188 wrapper.__signature__ = inspect.signature(func)
189 return wrapper

Callers

nothing calls this directly

Calls 14

ValueErrorClass · 0.85
strFunction · 0.85
_is_int_or_scalar_tensorFunction · 0.85
listFunction · 0.85
rangeFunction · 0.85
TypeErrorClass · 0.85
raise_deprecated_errorFunction · 0.85
_remap_kwargsFunction · 0.85
funcFunction · 0.50
allFunction · 0.50
popMethod · 0.45

Tested by

no test coverage detected