runtimepy.codec.system package#

Module contents#

A basic type-system implementation.

class runtimepy.codec.system.TypeSystem(*namespace: str)[source]#

Bases: LoggerMixin

A class for managing a custom type system.

add(custom_type: str, field_name: str, field_type: str, array_length: int = None, exact: bool = True) None[source]#

Add a field to a custom type.

enum(name: str, items: dict[str, int], *namespace: str, primitive: str = 'uint8') None[source]#

Register an enumeration.

get_enum(name: str, *namespace: str, exact: bool = True) RuntimeEnum[source]#

Lookup an enum type at runtime.

get_protocol(name: str, *namespace: str, exact: bool = True) Protocol[source]#

Get a custom protocol by name.

is_custom(name: str, *namespace: str, exact: bool = True) bool[source]#

Determine if the parameters identify a custom type.

is_enum(name: str, *namespace: str, exact: bool = True) bool[source]#

Determine if the arguments identify a registered enumeration.

register(name: str, *namespace: str, byte_order: ByteOrder | str | int = ByteOrder.NETWORK) Protocol[source]#

Register a custom type.

runtime_int_enum(enum: type[RuntimeIntEnum]) None[source]#

Register an enumeration class.

size(name: str, *namespace: str, trace: bool = False, exact: bool = True) int[source]#

Get the size of a named type.

runtimepy.codec.system.resolve_name(matches: Iterable[str]) str[source]#

Resolve a possible name conflict.