Module

flow

Declarative screen state machine with >> operator.

Classes

FlowScreen 4 ▼
A screen in a flow with its template and reducer.

A screen in a flow with its template and reducer.

Attributes

Name Type Description
name str —
template str —
reducer Callable —

Methods

Internal Methods 1 ▼
__rshift__ 1 Flow ▼
screen_a >> screen_b creates a Flow.
def __rshift__(self, other: FlowScreen) -> Flow
Parameters
Name Type Description
other —
Returns
Flow
FlowState 2 ▼
Runtime state for a flow.

Runtime state for a flow.

Attributes

Name Type Description
current_screen str —
screen_states dict[str, Any] —
Flow 7 ▼
Declarative multi-screen state machine.

Declarative multi-screen state machine.

Attributes

Name Type Description
screens tuple[FlowScreen, ...] —
transitions tuple[Transition, ...] —

Methods

template_map 0 dict[str, str] ▼
Map screen names to template names.
property
def template_map(self) -> dict[str, str]
Returns
dict[str, str]
from_screens 1 Flow ▼
Create a flow from an ordered sequence of screens.
classmethod
def from_screens(cls, *screens: FlowScreen) -> Flow
Parameters
Name Type Description
*screens —
Returns
Flow
with_transition 3 Flow ▼
Add a custom transition.
def with_transition(self, from_screen: str, to_screen: str, *, on: str) -> Flow
Parameters
Name Type Description
from_screen —
to_screen —
on —
Returns
Flow
build_reducer 0 Callable ▼
Build a combined reducer that routes actions to the current screen's reducer.
def build_reducer(self) -> Callable
Returns
Callable
Internal Methods 1 ▼
__rshift__ 1 Flow ▼
flow >> screen_c extends the flow.
def __rshift__(self, other: FlowScreen) -> Flow
Parameters
Name Type Description
other —
Returns
Flow