Skip to content

resolve_references

Resolve all references in a module.

Parameters:

Name Type Description Default
code str

The code of the module.

required
module_name str

The name of the module if any.

''
path str | None

The path of the module if any.

None
package_data PackageData | None

The module data of all modules the package. If provided, the references are resolved with the package data, else the module data is collected first. It is used for the inference of the purity between modules in the package.

None

Returns:

Type Description
ModuleAnalysisResult

The result of the reference resolving.

Source code in src/library_analyzer/processing/api/purity_analysis/_resolve_references.py
def resolve_references(
    code: str,
    module_name: str = "",
    path: str | None = None,
    package_data: PackageData | None = None,
) -> ModuleAnalysisResult:
    """Resolve all references in a module.

    Parameters
    ----------
    code :
        The code of the module.
    module_name :
        The name of the module if any.
    path :
        The path of the module if any.
    package_data :
        The module data of all modules the package.
        If provided, the references are resolved with the package data, else the module data is collected first.
        It is used for the inference of the purity between modules in the package.

    Returns
    -------
    ModuleAnalysisResult
        The result of the reference resolving.
    """
    return ReferenceResolver(code, module_name, path, package_data).module_analysis_result