Skip to content

build_call_graph

Build the call graph forest for the given classes and reasons.

Parameters:

Name Type Description Default
classes dict[str, ClassScope]

Classnames in the module as key and their corresponding ClassScope instance as value.

required
raw_reasons dict[NodeID, Reasons]

The raw reasons for impurity for all functions. Keys are the ids of the functions.

required

Returns:

Name Type Description
call_graph_forest CallGraphForest

The call graph forest for the given functions.

Source code in src/library_analyzer/processing/api/purity_analysis/_build_call_graph.py
def build_call_graph(classes: dict[str, ClassScope], raw_reasons: dict[NodeID, Reasons]) -> CallGraphForest:
    """Build the call graph forest for the given classes and reasons.

    Parameters
    ----------
    classes :
        Classnames in the module as key and their corresponding ClassScope instance as value.
    raw_reasons :
        The raw reasons for impurity for all functions.
        Keys are the ids of the functions.

    Returns
    -------
    call_graph_forest :
        The call graph forest for the given functions.
    """
    return CallGraphBuilder(classes, raw_reasons).call_graph_forest