delegators

Decorators for functions that delegate parts of their functionality to other functions.

New in version 0.10.0.

Data:

_C

Invariant TypeVar bound to typing.Callable.

Functions:

delegate_kwargs(to, *except_)

Decorator to replace **kwargs in function signatures with the parameter names from the delegated function.

delegates(to)

Decorator to replace *args, **kwargs function signatures with the signature of the delegated function.

_C = TypeVar(_C, bound=typing.Callable)

Type:    TypeVar

Invariant TypeVar bound to typing.Callable.

delegate_kwargs(to, *except_)[source]

Decorator to replace **kwargs in function signatures with the parameter names from the delegated function.

Parameters
  • to (Callable) – The function **kwargs is passed on to.

  • *except_ (str) – Parameter names not to delegate.

Raises

ValueError – if a non-default argument follows a default argument.

Return type

Callable[[~_C], ~_C]

delegates(to)[source]

Decorator to replace *args, **kwargs function signatures with the signature of the delegated function.

Parameters

to (Callable) – The function the arguments are passed on to.

Return type

Callable[[~_C], ~_C]