injector_fw.core¶

Core Logic for Framework Definition Injection (JSON).

This module provides the FrameworkInjector class, which handles the insertion or updating of Semantic Operations in the JSON definition files located in src/ml_switcheroo/frameworks/definitions/.

It replaces the legacy LibCST-based injector that modified Python source code.

Classes¶

FrameworkInjector

Injects a FrameworkVariant entry into the framework's JSON definitions.

Module Contents¶

class injector_fw.core.FrameworkInjector(target_fw: str, op_name: str, variant: ml_switcheroo.core.dsl.FrameworkVariant)¶

Injects a FrameworkVariant entry into the framework’s JSON definitions.

It handles: 1. Loading the existing JSON mapping. 2. Merging the new variant data. 3. Writing the updated JSON back to disk.

target_fw¶
op_name¶
variant¶
json_path¶
found = False¶
inject(dry_run: bool = False) → bool¶

Executes the injection process.

Parameters:

dry_run – If True, prints changes to console instead of writing file.

Returns:

True if the operation was successful.

Return type:

bool