tron.utils.state module¶
- class tron.utils.state.Machine(initial: str, **transitions: Mapping[str, str])¶
Bases:
object- check(transition)¶
Check if the state can be transitioned via transition. Returns the destination state.
- static from_machine(machine, initial=None, state=None)¶
- reset()¶
- set_state(state)¶
- transition(transition)¶
Checks if machine can be transitioned from current state using provided transition name. Returns True if transition has taken place. Listeners for this change will also be notified before returning.