Skip to content

pyflightstream.script.toggles (stable)

Generated from the docstrings at build time: every one of the 3 names in the __all__ of pyflightstream.script.toggles has an entry below. The names a guide or an example uses come first; the others follow under Advanced.

The solver's on/off vocabulary, read in both directions.

Pipeline role: leaf of the script layer. FlightStream writes every on/off flag as the words ENABLE and DISABLE (FSM-26.120 pp.339-346), so a setup carried over from the solver, a preset, or an interface export speaks that vocabulary while Python speaks True and False. This module is the single home of the translation: the curated helpers render it, the case models read it, and neither can drift from the other.

Why a reader at all, rather than passing the value through: a non-empty Python string is truthy, so 'DISABLE' tested as a bare condition is True and would emit ENABLE, inverting the physics of the run with no error anywhere (incident INC-20260723-2027-pyflightstream). Truthiness has no failure mode; this reader does.

Advanced

pyflightstream.script.toggles.SOLVER_TOGGLE_WORDS module-attribute

SOLVER_TOGGLE_WORDS: Mapping[str, bool] = MappingProxyType(
    {"ENABLE": True, "DISABLE": False}
)

pyflightstream.script.toggles.Toggle module-attribute

Toggle = bool | Literal['ENABLE', 'DISABLE']

pyflightstream.script.toggles.resolve_toggle

resolve_toggle(
    value: object, *, context: str = "a solver toggle"
) -> bool

Resolve a solver toggle written in either vocabulary.

Parameters:

Name Type Description Default
value bool or str

True or False, or "ENABLE" or "DISABLE" in any case.

required
context str

What is being resolved, quoted in the refusal; callers inside the library use the helper: argument shape of the entity resolver.

'a solver toggle'

Returns:

Type Description
bool

The toggle state.

Raises:

Type Description
CommandArgumentError

If the value is neither a bool nor one of the solver's words. It is a ValueError, so inside a pydantic model it surfaces as a ValidationError naming the field, and the message below is what survives.

Examples:

A preset line carried over from the solver:

>>> resolve_toggle("DISABLE", context="solver_settings: viscous_coupling")
False