dags.signature
#
Module Contents#
Functions#
|
Create a inspect.Signature object based on args and kwargs. |
|
Decorator that adds a signature to a function of type |
|
|
|
|
|
|
|
Rename positional and keyword arguments of func. |
- dags.signature.create_signature(args=None, kwargs=None)[source]#
Create a inspect.Signature object based on args and kwargs.
- dags.signature.with_signature(func=None, *, args=None, kwargs=None, enforce=True)[source]#
Decorator that adds a signature to a function of type
f(*args, **kwargs)
Caveats: The created signature only contains the names of arguments and whether they are keyword only. There is no way of setting default values, type hints or other things.
- Parameters
func (callable) – The function to be decorated. Should take
*args
and**kwargs
as only arguments.args (list or None) – The names of positional or keyword arguments.
kwargs (list or None) – The keyword only arguments.
enforce (bool) – Whether the signature should be enforced or just added to the function for introspection. This creates runtime overhead.
- Returns
The function with signature.
- Return type
function
- dags.signature.rename_arguments(func=None, *, mapper=None)[source]#
Rename positional and keyword arguments of func.
- Parameters
func (callable) – The function of which the arguments are renamed.
mapper (dict) – Dict of strings where keys are old names and values are new of arguments.
- Returns
The function with renamed arguments.
- Return type
function