runtimepy.channel.environment.command package#
Submodules#
runtimepy.channel.environment.command.parser module#
A module implementing a channel-environment command argument parser wrapper.
- class runtimepy.channel.environment.command.parser.ChannelCommand(*values)[source]#
Bases:
StrEnum
An enumeration for all channel command options.
- CUSTOM = 'custom'#
- GET = 'get'#
- SET = 'set'#
- TOGGLE = 'toggle'#
- class runtimepy.channel.environment.command.parser.CommandParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)[source]#
Bases:
ArgumentParser
An argument parser wrapper.
- data: dict[str, Any]#
runtimepy.channel.environment.command.processor module#
A module implementing a channel-command processing interface.
- class runtimepy.channel.environment.command.processor.ChannelCommandProcessor(env: ChannelEnvironment, logger: Logger | LoggerAdapter[Any], **kwargs)[source]#
Bases:
ChannelEnvironmentMixin
A command processing interface for channel environments.
- command(value: str) CommandResult [source]#
Process a command.
- do_set(args: Namespace) CommandResult [source]#
Attempt to set a channel value.
- do_toggle(args: Namespace, channel: BitField | Channel[Int8Primitive] | Channel[Int16Primitive] | Channel[Int32Primitive] | Channel[Int64Primitive] | Channel[Uint8Primitive] | Channel[Uint16Primitive] | Channel[Uint32Primitive] | Channel[Uint64Primitive] | Channel[FloatPrimitive] | Channel[DoublePrimitive] | Channel[BooleanPrimitive]) CommandResult [source]#
Attempt to toggle a channel.
- handle_command(args: Namespace) CommandResult [source]#
Handle a command from parsed arguments.
- async handle_custom_command(args: Namespace, channel: BitField | Channel[Int8Primitive] | Channel[Int16Primitive] | Channel[Int32Primitive] | Channel[Int64Primitive] | Channel[Uint8Primitive] | Channel[Uint16Primitive] | Channel[Uint32Primitive] | Channel[Uint64Primitive] | Channel[FloatPrimitive] | Channel[DoublePrimitive] | Channel[BooleanPrimitive] | None) None [source]#
Handle a custom command.
- register_custom_commands(*custom_commands: Callable[[Namespace, BitField | Channel[Int8Primitive] | Channel[Int16Primitive] | Channel[Int32Primitive] | Channel[Int64Primitive] | Channel[Uint8Primitive] | Channel[Uint16Primitive] | Channel[Uint32Primitive] | Channel[Uint64Primitive] | Channel[FloatPrimitive] | Channel[DoublePrimitive] | Channel[BooleanPrimitive] | None], Awaitable[None]]) None [source]#
Register custom commands.
- class runtimepy.channel.environment.command.processor.RemoteCommandProcessor(env: ChannelEnvironment, logger: Logger | LoggerAdapter[Any], **kwargs)[source]#
Bases:
ChannelCommandProcessor
A command processing interface for channel environments.
- handle_command(args: Namespace) CommandResult [source]#
Handle a command from parsed arguments.
runtimepy.channel.environment.command.result module#
A module implementing a command result interface.
Module contents#
A module implementing UI command processing.
- class runtimepy.channel.environment.command.GlobalEnvironment(root: Path = None)[source]#
Bases:
UserDict
[str
,ChannelCommandProcessor
],LoggerMixin
A class implementing a container for channel environments available globally at runtime.
- event_telemetry_output(env_pattern: str = '.*', env_exact: bool = False, channel_pattern: str = '.*', channel_exact: bool = False, event_path: str = 'event_stream.bin', text_log: bool = True) Iterator[list[tuple[str, list[str]]]] [source]#
Register file-output streams for environments based on a pattern.
- file_event_stream(env: str, pattern: str = '.*', path: str = 'event_stream.bin', exact: bool = False) Iterator[list[str]] [source]#
Enable event streaming to a file for an environment by name.
- static from_root(root: Path) GlobalEnvironment [source]#
Load a global environment from a directory.
- log_file(path: str = 'log.txt') Iterator[FileHandler] [source]#
Register a logging file handler as a managed context.
- read_event_stream(env: str, path: str = 'event_stream.bin') Iterator[ParsedEvent] [source]#
Reade events from a specific environment.
- register(name: str, env: ChannelCommandProcessor) None [source]#
Register an environment.
- static temporary() Iterator[GlobalEnvironment] [source]#
Create a temporary global environment.
- property valid_root: Path#
Get the validated root directory.
- runtimepy.channel.environment.command.clear_env() None [source]#
Reset the global environment mapping.
- runtimepy.channel.environment.command.register_env(name: str, env: ChannelCommandProcessor) None [source]#
Register a channel environment globally.