openpectus.lang.exec.commands
Classes
Commands (instructions of type PCommand) that are executed by the interpreter |
|
Represents a command request for engine to execute. |
|
Represents a named command. |
|
Represents a name/command dictionary. |
Module Contents
- class openpectus.lang.exec.commands.InterpreterCommandEnum
Bases:
enum.StrEnumCommands (instructions of type PCommand) that are executed by the interpreter
- BASE = 'Base'
- INCREMENT_RUN_COUNTER = 'Increment run counter'
- RUN_COUNTER = 'Run counter'
- WAIT = 'Wait'
- static has_value(value)
Determine if enum has this string value defined. Case sensitive.
- Parameters:
value (str)
- class openpectus.lang.exec.commands.CommandRequest(name, arguments, source, exec_id=None)
Represents a command request for engine to execute.
- Parameters:
name (str)
arguments (str)
source (str)
exec_id (uuid.UUID | None)
- name: str
- arguments: str
- exec_id: uuid.UUID | None = None
- source: str
- command_exec_id: uuid.UUID | None = None
- __str__()
- Return type:
str
- static from_user(name, arguments='')
- Parameters:
name (str)
arguments (str)
- Return type:
- static from_interpreter(name, arguments, exec_id)
- Parameters:
name (str)
arguments (str)
exec_id (uuid.UUID | None)
- Return type:
- class openpectus.lang.exec.commands.Command(name, validatorFn=None, docstring=None, arg_parser=None)
Represents a named command.
- Parameters:
name (str)
validatorFn (Callable[[str], bool] | None)
docstring (str | None)
arg_parser (openpectus.lang.exec.uod.RegexNamedArgumentParser | None)
- name: str
- validatorFn = None
- docstring = None
- arg_parser = None
- __str__()
- Return type:
str
- is_complete()
- Return type:
bool
- validate_args(args)
- Parameters:
args (str)
- Return type:
bool
- property accepts_arguments: bool
- Return type:
bool
- class openpectus.lang.exec.commands.CommandCollection(commands=None)
Represents a name/command dictionary.
- Parameters:
commands (Iterable[Command] | None)
- __str__()
- Return type:
str
- property names: List[str]
Return the command names
- Return type:
List[str]
- __getitem__(tag_name)
- Parameters:
tag_name (str)
- add(cmd, exist_ok=True)
Add command to collection. If command name already exists and exist_ok is False, a ValueError is raised.
- Parameters:
cmd (Command)
exist_ok (bool)
- has(cmd_name)
- Parameters:
cmd_name (str)
- Return type:
bool
- clone()
Returns a deep clone of the collection.
- Return type:
- to_list()
- merge_with(other)
Returns a new CommandCollection with the combined commands of both collections.
In case of duplicate commands names, tags from other collection are used.
- Parameters:
other (CommandCollection)
- Return type: