Module modules.telemetry.websocket_commands

Functions

def parse(websocket_command: list[str],
enum: Type[enum.Enum] = modules.telemetry.websocket_commands.WebsocketCommand) ‑> enum.Enum
Expand source code
def parse(websocket_command: list[str], enum: Type[Enum] = WebsocketCommand) -> Enum:
    """
    Returns the websocket command as the matching command enum variable. Any remaining parameters will be left
    inside the websocket_command list parameter.
    """

    sub_command = websocket_command.pop(0)  # Get the highest level command

    try:
        next_enum = enum[sub_command.upper()]
    except KeyError:
        raise WebsocketCommandNotFound(sub_command)

    if websocket_command and type(next_enum.value) is not str:
        return parse(websocket_command, enum=next_enum.value)
    else:
        return next_enum

Returns the websocket command as the matching command enum variable. Any remaining parameters will be left inside the websocket_command list parameter.

def split_command_string(command: str) ‑> list[str]
Expand source code
def split_command_string(command: str) -> list[str]:
    """Splits a websocket command on the spaces."""
    return command.split(" ")

Splits a websocket command on the spaces.

Classes

class RecordCommands (*args, **kwds)
Expand source code
class RecordCommands(StrEnum):
    """Contains the structure for the record subcommands."""

    START = "start recording"
    STOP = "stop recording"

Contains the structure for the record subcommands.

Ancestors

  • enum.StrEnum
  • builtins.str
  • enum.ReprEnum
  • enum.Enum

Class variables

var START
var STOP
class ReplayCommands (*args, **kwds)
Expand source code
class ReplayCommands(StrEnum):
    """Contains the structure for the replay subcommands."""

    PLAY = "play replay"
    PAUSE = "pause replay"
    RESUME = "resume replay"
    SPEED = "speed replay"
    STOP = "stop replay"

Contains the structure for the replay subcommands.

Ancestors

  • enum.StrEnum
  • builtins.str
  • enum.ReprEnum
  • enum.Enum

Class variables

var PAUSE
var PLAY
var RESUME
var SPEED
var STOP
class WebsocketCommand (*args, **kwds)
Expand source code
class WebsocketCommand(Enum):
    """Contains the structure for the telemetry commands."""

    UPDATE = "update"
    RECORD = RecordCommands
    REPLAY = ReplayCommands

Contains the structure for the telemetry commands.

Ancestors

  • enum.Enum

Class variables

var RECORD
var REPLAY
var UPDATE
class WebsocketCommandNotFound (command: str)
Expand source code
class WebsocketCommandNotFound(Exception):
    """Raised when there is no matching command."""

    def __init__(self, command: str):
        self.command = command
        self.message = f"The websocket command '{command}' does not exist."
        super().__init__(self.message)

Raised when there is no matching command.

Ancestors

  • builtins.Exception
  • builtins.BaseException