aeat.application.wizard._runner module

The wizard runtime that walks a flow against a prompter.

run_flow iterates a WizardFlow’s sections in order, evaluates each question’s visible_when predicate against the canonical-token answers collected so far, asks the prompter for visible questions, runs the widget-level validator on the raw answer, accumulates the canonical-token dict, parses each value into its declared answer_type, and returns the flow’s answers_model instance.

Visibility is evaluated incrementally, one question at a time, so a question whose visible_when predicate names an earlier question in the same section sees that earlier answer. Evaluating a whole section’s visibility upfront — before any question in the section is answered — would treat such an intra-section gate’s parent as absent and wrongly hide the dependent question.

Section / question progress lines:

Before each section’s first visible question, the runner emits a translated “Sección N/M: <title>” header via the prompter’s optional emit_progress hook. Each question within the section prepends “(pregunta n/m) “ to its prompt via the same hook. The descriptor knows the static section / question counts; visible- when conditionals adjust the runtime per-section visible count.

run_flow(flow, prompter, *, defaults=None, force_visible=frozenset({}))[source]

Walk flow against prompter and return the typed answers model.

Parameters:
  • flow (WizardFlow) – The descriptor to drive.

  • prompter (Prompter) – The interaction source.

  • defaults (Mapping[str, str] | None) – Optional canonical-token defaults keyed by question id; override descriptor-declared defaults when present.

  • force_visible (frozenset[str]) – Question ids the operator named explicitly on a non-interactive command line. An explicitly-supplied flag is collected even when its visible_when gate would otherwise hide the question.

Return type:

BaseModel

Returns:

A validated instance of flow.answers_model.