pasteur.utils.data.gen_closure#
- class pasteur.utils.data.gen_closure(func, /, *args, _fn: str | None = None, _eat: list[str] | None = None, _return: Any | None = None, **keywords)[source]#
Creates a closure for function fun, by passing the positional arguments provided in this function to fun before the ones given to the function and by passing the sum of named arguments given to both functions.
The closure retains the original function name. If desired, it can be renamed using the _fn parameter. If fn contains %s, it will be replaced with the function name.
The _eat parameter can be used to consume keyword arguments passed to the child function. Ex. if _eat=[“bob”], passing bob=safd will have no effect on the bound function.
The _return parameter can override what the function returns.
Attributes
tuple of arguments to future partial calls
function object to use in future partial calls
dictionary of keyword arguments to future partial calls
Methods
- args#
tuple of arguments to future partial calls
- func#
function object to use in future partial calls
- keywords#
dictionary of keyword arguments to future partial calls