ml_switcheroo.semantics.merging¶

Merging Logic for Semantic Knowledge Base.

Handles: - Merging Specification Tiers (Math, Neural, Extras). - Merging Snapshot Overlays (Framework mappings). - Conflict resolution and prioritization.

Functions¶

infer_tier_from_priority(...)

Maps a loading priority integer to a Semantic Tier.

merge_imports(→ None)

Merges new import definitions (from __imports__ block) into the master dictionary.

merge_frameworks(→ None)

Merges new framework configurations (from __frameworks__ block) into the master.

merge_tier_data(→ None)

Merges content from a Specification file (hub) into the manager state.

merge_overlay_data(→ None)

Merges a mapping overlay file (snapshot) into the main data.

Module Contents¶

ml_switcheroo.semantics.merging.infer_tier_from_priority(priority: int) → ml_switcheroo.enums.SemanticTier¶

Maps a loading priority integer to a Semantic Tier.

Parameters:

priority (int) – Loading order (10=Math, 20=Neural, etc).

Returns:

The inferred tier enum.

Return type:

SemanticTier

ml_switcheroo.semantics.merging.merge_imports(master_import_data: Dict[str, Dict], new_imports: Dict[str, Any]) → None¶

Merges new import definitions (from __imports__ block) into the master dictionary. Updates in-place.

ml_switcheroo.semantics.merging.merge_frameworks(master_configs: Dict[str, Dict], new_configs: Dict[str, Any]) → None¶

Merges new framework configurations (from __frameworks__ block) into the master. Updates in-place.

ml_switcheroo.semantics.merging.merge_tier_data(data: Dict[str, Dict], key_origins: Dict[str, str], import_data: Dict[str, Dict], framework_configs: Dict[str, Dict], new_content: Dict[str, Any], tier: ml_switcheroo.enums.SemanticTier) → None¶

Merges content from a Specification file (hub) into the manager state.

Parameters:
  • data – Master dictionary of operations.

  • key_origins – Dict tracking where an op was defined (Math vs Neural).

  • import_data – Master dictionary of import mappings.

  • framework_configs – Master dictionary of framework traits.

  • new_content – The JSON content being loaded.

  • tier – The Semantic Tier of the file being loaded.

ml_switcheroo.semantics.merging.merge_overlay_data(data: Dict[str, Dict], key_origins: Dict[str, str], import_data: Dict[str, Dict], framework_configs: Dict[str, Dict], test_templates: Dict[str, Dict], content: Dict[str, Any], filename: str) → None¶

Merges a mapping overlay file (snapshot) into the main data.

Parameters:
  • data – Master dictionary of operations.

  • key_origins – Dict tracking tier origins.

  • import_data – Master dictionary of import mappings.

  • framework_configs – Master dictionary of framework traits.

  • test_templates – Master dictionary of testing templates.

  • content – The JSON content of the snapshot file.

  • filename – Filename for metadata inference if needed.