core
drunc.fsm.core
Classes
FSM(conf)
Source code in drunc/fsm/core.py
Functions
can_execute_transition(source_state, transition)
Check that this transition is allowed given the source_state
Source code in drunc/fsm/core.py
get_all_sequences()
get_all_states()
get_all_transitions()
get_destination_state(source_state, transition)
Tells us where a particular transition will take us, given the source_state
Source code in drunc/fsm/core.py
FSMAction(name)
PreOrPostTransitionSequence(transition, pre_or_post='pre')
Source code in drunc/fsm/core.py
Functions
add_callback(action, mandatory=True)
Add a callback to the sequence. The method to be called will be determined by the name of the transition and the prefix (pre or post).
For example, if the transition is "start" and the prefix is "pre", the method to be called will be "pre_start".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
FSMAction
|
The action to be added to the sequence. |
required |
mandatory
|
bool
|
Whether the callback is mandatory or not. |
True
|
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
DruncSetupException
|
If the method to be called is not found in the action. |
Source code in drunc/fsm/core.py
get_arguments()
Create a list of arguments.
This is a bit sloppy, as really, I shouldn't be using protobuf here, and convert them later, but... Thanks Pierre :/
Returns:
| Name | Type | Description |
|---|---|---|
list |
Argument
|
A list of arguments that the sequence requires. |
Raises:
| Type | Description |
|---|---|
UnhandledArgumentType
|
If the type of an argument is not one of the following: str, float, int, bool, Optional[str], Optional[float], Optional[int], Optional[bool], Union[str, None], Union[float, None], Union[int, None], Union[bool, None] |
Source code in drunc/fsm/core.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |