Skip to content

ModuleAnalysisResult

Class for module analysis results.

After the references of a module have been resolved, all necessary information for the purity analysis is available in this class.

Attributes:

Name Type Description
resolved_references dict[str, list[ReferenceNode]]

The dictionary of references. The key is the name of the reference node, the value is the list of ReferenceNodes.

raw_reasons dict[NodeID, Reasons]

The dictionary of function references. The key is the NodeID of the function, the value is the Reasons for the function.

classes dict[str, ClassScope]

All classes and their ClassScope.

call_graph_forest CallGraphForest

The call graph forest of the module.

module_id NodeID | None

The NodeID of the module which the analysis result belongs to.

Source code in src/library_analyzer/processing/api/purity_analysis/model/_reference.py
@dataclass
class ModuleAnalysisResult:
    """Class for module analysis results.

    After the references of a module have been resolved, all necessary information for the purity analysis is available in this class.

    Attributes
    ----------
    resolved_references :
        The dictionary of references.
        The key is the name of the reference node, the value is the list of ReferenceNodes.
    raw_reasons :
        The dictionary of function references.
        The key is the NodeID of the function, the value is the Reasons for the function.
    classes :
        All classes and their ClassScope.
    call_graph_forest : CallGraphForest
        The call graph forest of the module.
    module_id :
        The NodeID of the module which the analysis result belongs to.
    """

    resolved_references: dict[str, list[ReferenceNode]] = field(default_factory=dict)
    raw_reasons: dict[NodeID, Reasons] = field(default_factory=dict)
    classes: dict[str, ClassScope] = field(default_factory=dict)
    call_graph_forest: CallGraphForest | None = None
    module_id: NodeID | None = None

call_graph_forest: CallGraphForest | None = None class-attribute instance-attribute

classes: dict[str, ClassScope] = field(default_factory=dict) class-attribute instance-attribute

module_id: NodeID | None = None class-attribute instance-attribute

raw_reasons: dict[NodeID, Reasons] = field(default_factory=dict) class-attribute instance-attribute

resolved_references: dict[str, list[ReferenceNode]] = field(default_factory=dict) class-attribute instance-attribute

__init__(resolved_references=dict(), raw_reasons=dict(), classes=dict(), call_graph_forest=None, module_id=None)