firecrown.likelihood.gauss_family.gauss_family.enforce_states

Contents

firecrown.likelihood.gauss_family.gauss_family.enforce_states#

firecrown.likelihood.gauss_family.gauss_family.enforce_states(*, initial, terminal=None, failure_message)[source]#

This decorator wraps a method, and enforces state machine behavior.

If the object is not in one of the states in initial, an AssertionError is raised with the given failure_message. If terminal is None the state of the object is not modified. If terminal is not None and the call to the wrapped method returns normally the state of the object is set to terminal.

Parameters:
  • initial (State | list[State]) –

  • terminal (None | State) –

  • failure_message (str) –

Return type:

Callable[[Callable[[ParamSpec(P, bound= None)], TypeVar(T)]], Callable[[ParamSpec(P, bound= None)], TypeVar(T)]]