class _StateChange: (source)
Known subclasses: sqlalchemy.orm.session.SessionTransaction
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 |
Method decorator declaring valid states. |
Method | _expect |
called within a method that changes states. |
Method | _raise |
Undocumented |
Class Variable | _current |
Undocumented |
Instance Variable | _next |
Undocumented |
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.
def _expect_state(self, expected:
_StateChangeState
) -> Iterator[ Any]
:
(source)
¶
called within a method that changes states. method must also use the ``@declare_states()`` decorator.
str
, state: _StateChangeState
) -> NoReturn
:
(source)
¶
sqlalchemy.orm.session.SessionTransaction
Undocumented