lisa.utils.kwargs_forwarded_to#
- lisa.utils.kwargs_forwarded_to(f, ignore=None)[source]#
Similar to
functools.wraps(), except that it will only fixup the signature.The signature is modified in the following way:
Variable keyword parameters are removed
All the parameters that
ftake are added as keyword-only in the decorated function’s signature, under the assumption that**kwargsin the decorated function is used to relay the parameters tof.
Example:
def f(x, y, z): pass @kwargs_forwarded_to(f) def g(z, **kwargs): f(**kwargs) return z # The signature of g() is now "(z, *, x, y)", i.e. x and y are # keyword-only.