Collects components of the source for the decorated function wrapping f.

If f has multiple argmap decorators, we recursively assemble the stack of decorators into a single flattened function.

This method is part of the compile method’s process yet separated from that method to allow recursive processing. The outputs are strings, dictionaries and lists that collect needed info to flatten any nested argmap-decoration.


The function to be decorated. If f is argmapped, we assemble it.


The function signature as an argmap.Signature object.


The mangled name used to represent the wrapped function in the code being assembled.


A dictionary mapping id(g) -> (mangled_name(g), g) for functions g referred to in the code being assembled. These need to be present in the globals scope of exec when defining the decorated function.

mapblocklist of lists and/or strings

Code that implements mapping of parameters including any try blocks if needed. This code will precede the decorated function call.

finallyslist of lists and/or strings

Code that implements the finally blocks to post-process the arguments (usually close any files if needed) after the decorated function is called.


True if the decorator needs to modify positional arguments via their indices. The compile method then turns the argument tuple into a list so that the arguments can be modified.