Skip to main content

Step.from_state()

Reconstruct a step from the dict produced by to_state.

Usage

Source

Step.from_state(state)

Bypasses __init__ and restores the decoded fields directly. Any attribute missing from state (e.g. a field added in a newer version) keeps whatever a bare instance would carry, so within a major version an older payload loads cleanly without per-field shims.

state is meant to be one this process produced. A payload from outside goes through FittedRecipe.from_dict, which also restricts the classes the state may name; called directly, this accepts any importable class name in state. Either way a key that would replace a method or property raises ValueError, but the values are not validated.