argmap.signature#
- classmethod argmap.signature(f)[source]#
Construct a Signature object describing
f
Compute a Signature so that we can write a function wrapping f with the same signature and call-type.
- Parameters:
- fcallable
A function to be decorated
- Returns:
- sigargmap.Signature
The Signature of f
Notes
The Signature is a namedtuple with names:
name : a unique version of the name of the decorated function signature : the inspect.signature of the decorated function def_sig : a string used as code to define the new function call_sig : a string used as code to call the decorated function names : a dict keyed by argument name and index to the argument’s name n_positional : the number of positional arguments in the signature args : the name of the VAR_POSITIONAL argument if any, i.e. *theseargs kwargs : the name of the VAR_KEYWORDS argument if any, i.e. **kwargs
These named attributes of the signature are used in
assemble
andcompile
to construct a string of source code for the decorated function.