ml_switcheroo.semantics.manager¶
SemanticsManager for Knowledge Base Loading and Updating.
This module acts as the central database and coordinator for the Semantic Knowledge Base. It delegates file loading and registry introspection to helper modules, serving as the primary API for querying operation definitions.
Core Responsibilities: 1. State Management: Holds the merged view of operations, traits, and aliases. 2. Querying: Resolves Abstract Operations to Framework-Specific Variants. 3. Coordination: Triggers file loaders and code hydrators on initialization.
Classes¶
Central database for semantic mappings and configuration. |
Module Contents¶
- class ml_switcheroo.semantics.manager.SemanticsManager[source]¶
Central database for semantic mappings and configuration.
It aggregates data from sources: 1. File System: JSON Specs (semantics/) and Overlays (snapshots/). 2. Code Registry: Python classes (FrameworkAdapter, Plugin).
- data: Dict[str, Dict]¶
- framework_configs: Dict[str, Dict]¶
- test_templates: Dict[str, Dict]¶
- known_magic_args: Set[str]¶
- patterns: List[ml_switcheroo.semantics.schema.PatternDef] = []¶
- get_import_map(target_fw: str) Dict[str, Tuple[str, str | None, str | None]][source]¶
Generates the import mapping for the ImportFixer based on Tier linking.
- Parameters:
target_fw – The framework being targeted.
- Returns:
Dict mapping source import paths to (root, sub, alias) tuples.
- resolve_variant(abstract_id: str, target_fw: str) Dict[str, Any] | None[source]¶
Resolves the implementation of an abstract operation.
- is_verified(abstract_id: str) bool[source]¶
Returns True if the operation is marked verified (or untracked).
- get_definition(api_name: str) Tuple[str, Dict] | None[source]¶
Reverse lookup from concrete API string or Abstract ID fallback.
- get_framework_config(framework: str) Dict[str, Any][source]¶
Returns definition of framework traits.
- get_test_template(framework: str) Dict[str, str] | None[source]¶
Returns testing codegen templates.
- get_framework_aliases() Dict[str, Tuple[str, str]][source]¶
Returns a map of {fw: (module, alias)}.
- get_patterns() List[ml_switcheroo.semantics.schema.PatternDef][source]¶
Returns the list of loaded fusion patterns.