Modules¶
jonga module¶
Call tracing for class method inheritance documentation
- current_function(frame)[source]¶
Get reference to currently running function from inspect/trace stack frame.
- Parameters:
- framestack frame
Stack frame obtained via trace or inspect
- Returns:
- fncfunction reference
Currently running function
- function_qname(fnc)[source]¶
Get qualified name of a function (the fully qualified name without the module prefix).
- Parameters:
- fncfunction reference
A function reference
- Returns:
- fqnstring
The qualified name the function
- function_fqname(fnc)[source]¶
Get fully qualified name of a function.
- Parameters:
- fncfunction reference
A function reference
- Returns:
- fqnstring
The fully qualified name the function
- current_module_name(frame)[source]¶
Get name of module of currently running function from inspect/trace stack frame.
- Parameters:
- framestack frame
Stack frame obtained via trace or inspect
- Returns:
- modnamestring
Currently running function module name
- class CallTracer(srcmodflt=None, dstmodflt=None, srcqnmflt=None, dstqnmflt=None, fnmsub=None, grpflt=None, lnksub=None)[source]¶
Bases:
object
Manage construction of a call graph for methods within a class hierarchy.
- Parameters:
- srcmodfltNone or regex string, optional (default None)
A regex for call filtering based on calling function module. A function call is only recorded if the regex matches the name of the calling function module. If None, filtering is disabled.
- dstmodfltNone or regex string, optional (default None)
A regex for call filtering based on caller function. A function call is only recorded if the regex matches the name of the called function module. If None, filtering is disabled.
- srcqnmfltNone or regex string, optional (default None)
A regex for call filtering based on calling function qname. A function call is only recorded if the regex matches the name of the calling function. If None, filtering is disabled.
- dstqnmfltNone or regex string, optional (default None)
A regex for call filtering based on caller function qname. A function call is only recorded if the regex matches the name of the called function. If None, filtering is disabled.
- fnmsubNone or tuple of two regex strings, optional (default None)
A tuple of match and replace regex strings for computing graph node names from function qnames. If None, node names are function qnames.
- grpfltNone or regex string, optional (default None)
A regex string for extracting part of the function fqname as a group name. If None, groups are not defined.
- lnksubNone or tuple of two regex strings, optional (default None)
A tuple of match and replace regex strings for computing node href attributes from node names. If None, href attributes are not defined.
- graph(fnm=None, size=None, fntsz=None, fntfm=None, clrgen=None, rmsz=False, prog='dot')[source]¶
Construct call graph.
- Parameters:
- fnmNone or string, optional (default None)
Filename of graph file to be written. File type is determined by the file extensions (e.g. dot for ‘graph.dot’ and SVG for ‘graph.svg’). If None, a file is not written.
- sizestring or None, optional (default None)
Graph image size specification string.
- fntszint or None, optional (default None)
Font size for text.
- fntnmstring or None, optional (default None)
Font family specification string.
- clrgenfunction or None, optional (default None)
Function to call to generate the group colours. This function should take an integer specifying the number of groups as an argument and return a list of graphviz-compatible colour specification strings.
- rmszbool, optional (default False)
If True, remove the width and height specifications from an SVG format output file so that the size scales properly when viewed in a web browser
- progstring, optional (default ‘dot’)
Name of graphviz layout program to use.
- Returns:
- pgrpygraphviz.AGraph
Call graph of traced function calls
- class ContextCallTracer(ct, pth=None, **kwargs)[source]¶
Bases:
object
A wrapper class for
CallTracer
that enables its use as a context manager. At the end of the context a call graph image is generated and written to a path specified in the initialiser.- Parameters:
- ctclass:CallTracer object
Specify the call tracer object to be used as a context manager.
- pthstring or None, optional (default None)
Specify the path of the graph image file to be written by
CallTracer.graph()
at the end of the context. A graph is not generated if it isNone
.- **kwargs
Keyword arguments for
CallTracer.graph()