|
Python YASMIN (Yet Another State MachINe)
|


Public Member Functions | |
| None | __init__ (self, Set[str] outcomes, Callable cb) |
| str | execute (self, Blackboard blackboard) |
Public Member Functions inherited from yasmin.state.State | |
| None | __init__ (self, Set[str] outcomes) |
| str | __call__ (self, Blackboard blackboard=None) |
| str | __str__ (self) |
| None | cancel_state (self) |
| bool | is_canceled (self) |
| bool | is_running (self) |
| Set[str] | get_outcomes (self) |
Protected Attributes | |
| Callable | _cb = cb |
| A callable that will be invoked when the state is executed. | |
Protected Attributes inherited from yasmin.state.State | |
| Set | _outcomes = set() |
| A set of valid outcomes for this state. | |
| bool | _running = False |
| A flag indicating whether the state is currently running. | |
| bool | _canceled = False |
| A flag indicating whether the state has been canceled. | |
CbState is a subclass of State that encapsulates a callback function
which can be executed in response to a specific state.
Attributes:
_cb (Callable): A callback function that defines the action to take
when the state is executed.
Parameters:
outcomes (Set[str]): A set of possible outcomes for this state.
cb (Callable): A callable that will be invoked when the state is executed.
| None yasmin.cb_state.CbState.__init__ | ( | self, | |
| Set[str] | outcomes, | ||
| Callable | cb ) |
Initializes a new instance of CbState.
Args:
outcomes (Set[str]): A set of possible outcomes for this state.
cb (Callable): A callable that defines the action to take when
the state is executed.
Raises:
TypeError: If 'outcomes' is not a set or 'cb' is not callable.
| str yasmin.cb_state.CbState.execute | ( | self, | |
| Blackboard | blackboard ) |
Executes the callback function with the provided blackboard context.
Args:
blackboard: The context in which the callback will be executed.
This is typically an object that holds the necessary
state or data for the callback.
Returns:
str: The result of the callback function execution.
Raises:
Exception: Propagates any exceptions raised by the callback function.
Reimplemented from yasmin.state.State.
|
protected |
A callable that will be invoked when the state is executed.