cornflakes.decorator.wrap_kwargs
- cornflakes.decorator.wrap_kwargs(wrapped, exclude=None, **overwrites)
Function Decorator that can update all passed arguments (that can be a variable) of function.
- Parameter:
wrapped (Callable) – The original function to be wrapped.
exclude (List[str], optional) – A list of keys to exclude from wrapping.
**overwrites – Keyword arguments that specify default values to overwrite.
- Rückgabe:
A function that wraps the original function.
- Rückgabetyp:
Callable
>>> @wrap_kwargs(wrapped=sum) ... def new_sum(**kwargs): ... return kwargs >>> new_sum([1, 2, 3]) # Output would be 16 because 'start' is overwritten to 10 {'iterable': [1, 2, 3]}