ml_switcheroo.core.rewriter.interface¶

Interface definition for Rewriter Passes.

This module defines the abstract base class that all transformation passes must implement to be compatible with the RewriterPipeline.

Classes¶

RewriterPass

Abstract contract for a transformation pass in the rewriting pipeline.

Module Contents¶

class ml_switcheroo.core.rewriter.interface.RewriterPass[source]¶

Bases: abc.ABC

Abstract contract for a transformation pass in the rewriting pipeline.

Passes encapsulate discrete transformation logic (e.g. Structural Rewriting, API Remapping) and are executed sequentially by the pipeline.

abstractmethod transform(module: libcst.Module, context: ml_switcheroo.core.rewriter.context.RewriterContext) → libcst.Module[source]¶

Executes the transformation logic on the given CST module.

Parameters:
  • module – The input LibCST module.

  • context – The shared rewriter context containing configuration and state.

Returns:

The transformed LibCST module.