networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
assemble(self, 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.

Parameters

f : callable

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

Returns

sig : argmap.Signature

The function signature as an :None:None:`argmap.Signature` object.

wrapped_name : str

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

functions : dict

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.

mapblock : list 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.

finallys : list 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.

mutable_args : bool

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.

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

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.utils.decorators.argmap networkx.utils.decorators.argmap.compile

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/utils/decorators.py#976
type: <class 'function'>
Commit: