mate_common.state_machine module

Typing protocols and mixins for using Python enums as state machines.

class mate_common.state_machine.StateMachineMixin

Bases: object

can_transition_to(other: mate_common.state_machine._Transitionable) bool

Returns whether the current state can transition to the given other state.

Parameters
  • self (mate_common.state_machine._Transitionable) –

  • other (mate_common.state_machine._Transitionable) –

Return type

bool

is_terminal() bool

Returns whether this state is terminal, i.e. has no transitions.

Parameters

self (mate_common.state_machine._Transitionable) –

Return type

bool

start() mate_common.state_machine._Transitionable
Parameters

self (mate_common.state_machine._Transitionable) –

Return type

mate_common.state_machine._Transitionable