ml_switcheroo.core.import_fixer.resolution¶

Import Resolution Logic.

This module centralizes the decision-making process for imports. It allows the current codebase to be analyzed before transformation commits to determine imports.

Classes¶

ImportReq

Represents a normalized import requirement.

ResolutionPlan

The strategy for the ImportFixer to execute.

ImportResolver

Module Contents¶

class ml_switcheroo.core.import_fixer.resolution.ImportReq[source]¶

Represents a normalized import requirement. Can represent import module as alias or from module import sub as alias.

module: str¶
subcomponent: str | None = None¶
alias: str | None = None¶
property signature: str¶

Unique signature for deduplication.

class ml_switcheroo.core.import_fixer.resolution.ResolutionPlan[source]¶

The strategy for the ImportFixer to execute.

required_imports: List[ImportReq] = []¶
mappings: Dict[str, ImportReq]¶
path_to_alias: Dict[str, str]¶
class ml_switcheroo.core.import_fixer.resolution.ImportResolver(semantics: ml_switcheroo.semantics.manager.SemanticsManager)[source]¶
semantics¶
resolve(tree: libcst.Module, target_fw: str) → ResolutionPlan[source]¶