Skip to content

function_calls_to_side_effects

function_calls_to_side_effects(function_inspector, function_calls, input_nodes, output_globals)

Translates a list of function calls to a list of side effects, by mapping objects to nodes.

Parameters:

Name Type Description Default
function_inspector FunctionInspector

The function inspector to use to lookup what side effects each function call has.

required
function_calls Iterable[FunctionCall]

The function calls that were recorded.

required
input_nodes Mapping[LineaID, object]

Mapping of node ID to value for all the nodes that were passed in to this execution.

required
output_globals Mapping[str, object]

Mapping of global identifier to the value of all globals that were set during this execution.

required
Source code in lineapy/system_tracing/function_calls_to_side_effects.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
def function_calls_to_side_effects(
    function_inspector: FunctionInspector,
    function_calls: Iterable[FunctionCall],
    input_nodes: Mapping[LineaID, object],
    output_globals: Mapping[str, object],
) -> Iterable[SideEffect]:
    """
    Translates a list of function calls to a list of side effects, by mapping objects to nodes.

    Parameters
    ----------
    function_inspector: FunctionInspector
        The function inspector to use to lookup what side effects each function call has.
    function_calls: Iterable[FunctionCall]
        The function calls that were recorded.
    input_nodes: Mapping[LineaID, object]
        Mapping of node ID to value for all the nodes that were passed in to this execution.
    output_globals: Mapping[str, object]
        Mapping of global identifier to the value of all globals that were set during this execution.
    """
    logger.debug("Converting function calls to object side effects")

    object_side_effects = function_calls_to_object_side_effects(
        function_inspector, function_calls
    )

    logger.debug("Converting object side effects to node side effects")
    return object_side_effects_to_side_effects(
        object_side_effects, input_nodes, output_globals
    )

Was this helpful?

Help us improve docs with your feedback!