utils
drunc.fsm.utils
Functions
convert_fsm_transition(transitions)
Converts a list of FSM transitions to a FSMCommandsDescription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transitions
|
list[Transition]
|
A list of FSM transitions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
FSMCommandsDescription |
FSMCommandsDescription
|
A FSMCommandsDescription containing the converted transitions. |
Source code in drunc/fsm/utils.py
decode_fsm_arguments(arguments, arguments_format)
Decodes the arguments of a FSM command.
Note there is separate logic to validate whether the required arguments are all present at the click.core.Command level, this is a safeguard to support the multiple drunc operating modes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arguments
|
MutableMapping[str, Any]
|
The arguments to decode. |
required |
arguments_format
|
list[Argument]
|
The format of the arguments. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, str | int | float | bool]
|
dict[str, str | int | float | bool]: The decoded arguments. |
Raises:
| Type | Description |
|---|---|
MissingArgument
|
If a mandatory argument is missing. |
UnhandledArgumentType
|
If an argument type is not handled. |