class documentation

Supplies state assertion decorators. The current use case is for the :class:`_orm.SessionTransaction` class. The :class:`_StateChange` class itself is agnostic of the :class:`_orm.SessionTransaction` class so could in theory be generalized for other systems as well.

Class Method declare_states Method decorator declaring valid states.
Method _expect_state called within a method that changes states.
Method _raise_for_prerequisite_state Undocumented
Class Variable _current_fn Undocumented
Instance Variable _next_state Undocumented
@classmethod
def declare_states(cls, prerequisite_states: Union[Literal[_StateChangeStates.ANY], Tuple[_StateChangeState, ...]], moves_to: _StateChangeState) -> Callable[[_F], _F]: (source)

Method decorator declaring valid states. :param prerequisite_states: sequence of acceptable prerequisite states. Can be the single constant _State.ANY to indicate no prerequisite state :param moves_to: the expected state at the end of the method, assuming no exceptions raised. Can be the constant _State.NO_CHANGE to indicate state should not change at the end of the method.

called within a method that changes states. method must also use the ``@declare_states()`` decorator.

def _raise_for_prerequisite_state(self, operation_name: str, state: _StateChangeState) -> NoReturn: (source)

Undocumented

_current_fn: Optional[Callable[..., Any]] = (source)

Undocumented

_next_state = (source)

Undocumented