runtimepy.channel package#

Subpackages#

Submodules#

runtimepy.channel.registry module#

A module implementing a channel registry.

class runtimepy.channel.registry.ChannelNameRegistry(mapping: MutableMapping[int, str] = None, reverse: MutableMapping[str, int] = None)[source]#

Bases: NameRegistry

A name registry with a name-matching pattern for channel names.

name_regex: _Pattern | None = re.compile('^[a-zA-Z0-9_.-]+$')#
class runtimepy.channel.registry.ChannelRegistry(data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]] = None, schemas: SchemaMap = None, dest_attr: str = 'data', verify: bool = True)[source]#

Bases: Registry[Channel[Any]]

A runtime enumeration registry.

channel(name: str, kind: Primitive[Any] | type[Int8Primitive | Int16Primitive | Int32Primitive | Int64Primitive | Uint8Primitive | Uint16Primitive | Uint32Primitive | Uint64Primitive | HalfPrimitive | FloatPrimitive | DoublePrimitive | BooleanPrimitive] | str, commandable: bool = False, enum: str | int = None, scaling: list[float | int] = None, description: str = None, default: int | float | bool | None = None, controls: dict[str, int | float | bool | dict[str, int | float | bool]] | str = None, **kwargs) Channel[Int8Primitive] | Channel[Int16Primitive] | Channel[Int32Primitive] | Channel[Int64Primitive] | Channel[Uint8Primitive] | Channel[Uint16Primitive] | Channel[Uint32Primitive] | Channel[Uint64Primitive] | Channel[FloatPrimitive] | Channel[DoublePrimitive] | Channel[BooleanPrimitive] | None[source]#

Create a new channel.

event_fifo: ByteFifo#
event_header: Protocol#
header_ready: bool#
init(data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]]) None[source]#

Perform implementation-specific initialization.

property kind: type[Channel[Any]]#

Determine what kind of registry this is.

name_registry#

alias of ChannelNameRegistry

registered(stream: BinaryIO, pattern: str = '.*', exact: bool = False, flush: bool = False, channel: ChannelMetrics = None) Iterator[list[str]][source]#

Register a stream as a managed context. Returns a list of all channels registered.

class runtimepy.channel.registry.ParsedEvent(name: str, timestamp: int, value: bool | int | float)[source]#

Bases: NamedTuple

A raw channel event.

static by_channel(event_stream: Iterable[ParsedEvent]) dict[str, list[ParsedEvent]][source]#

Get a dictionary of channel events broken down by individual channels.

name: str#

Alias for field number 0

timestamp: int#

Alias for field number 1

value: bool | int | float#

Alias for field number 2

Module contents#

A module implementing a basic channel interface.

class runtimepy.channel.Channel(data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]] = None, schemas: SchemaMap = None, dest_attr: str = 'data', verify: bool = True)[source]#

Bases: RegistryItem, EnumMixin, Generic[T]

An interface for an individual channel.

asdict() dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]][source]#

Obtain a dictionary representing this instance.

default: int | float | bool | None#
property has_default: bool#

Determine if this channel has a default value configured.

init(data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]]) None[source]#

Perform implementation-specific initialization.

raw: T#
set_default(default: int | float | bool | None = None) None[source]#

Set a new default value for this channel.

property type: Int8Type | Int16Type | Int32Type | Int64Type | Uint8Type | Uint16Type | Uint32Type | Uint64Type | HalfType | FloatType | DoubleType | BooleanType#

Get the underlying primitive type of this channel.

update_primitive(primitive: T) None[source]#

Use a new underlying primitive for this channel.