lisa.utils.update_wrapper_doc#

lisa.utils.update_wrapper_doc(func, added_by=None, sig_from=None, description=None, remove_params=None, include_kwargs=False)[source]#

Equivalent to functools.wraps() that updates the signature by taking into account the wrapper’s extra keyword-only parameters and the given description.

Parameters:
  • func (collections.abc.Callable) – callable to decorate

  • added_by (collections.abc.Callable or str or None) – Add some kind of reference to give a sense of where the new behaviour of the wraps function comes from.

  • sig_from (collections.abc.Callable) – By default, the signature containing the added parameters will be taken from func. This allows overriding that, in case func is just a wrapper around something else.

  • description (str or None) – Extra description output in the docstring.

  • remove_params (list(str) or None) – Set of parameter names of func to not include in the decorated function signature. This can be used to hide parameters that are only used as part of a decorated/decorator protocol, and not exposed in the final decorated function.

  • include_kwargs (bool) – If True, variable keyword parameter (**kwargs) of the decorator is kept in the signature. It is usually removed, since it’s mostly used to transparently forward arguments to the inner func, but can also serve other purposes.

Note

functools.wraps() is applied by this decorator, which will not work if you applied it yourself.