factory
Shape-based preprocessor factory shared by every consuming step.
A step declares an ordered list of (shape_detector, pipeline) candidates and
gets a uniform preprocess(df, *, datasource) from build_preprocessor.
Centralising the shape-matching loop keeps every step's preprocessing.py to
the same shape — a _CANDIDATES list and a preprocess — with no duplicated
loop or divergent no-match handling.
Module
Functions
build_preprocessor
def build_preprocessor( candidates: Sequence[ShapeCandidate], *, step_name: str,) ‑> collections.abc.Callable[..., pandas.core.frame.DataFrame]:Build a step's preprocess from its ordered shape candidates.
Arguments
candidates: Ordered(shape_detector, pipeline)pairs. The first detector that matches the frame wins; its pipeline is applied.step_name: The consuming step's name, used in the no-match warning.
Returns
preprocess(df, *, datasource): applies the first matching candidate's
pipeline, or returns df unchanged when it is empty or no candidate
matches (passthrough + warn).