cable_club.data package

Submodules

Module contents

Anything related with data.

class cable_club.data.Reader[source]

Bases: object

Parse incoming data.

boolean(*, allow_none: Literal[False] = False) bool[source]
boolean(*, allow_none: Literal[True] = False) bool | None

Get a bool from the reader.

fields: list[str]
integer(*, min_val: int | None = None, max_val: int | None = None, allow_none: Literal[False] = False) int[source]
integer(*, min_val: int | None = None, max_val: int | None = None, allow_none: Literal[True] = False) int | None

Get an int from the reader.

left() list[str][source]

Return raw data.

classmethod new(raw: bytes) Self | None[source]

Try an initialize a reader.

one_of(*, options: Container[str]) str[source]

Read a value within a set of options.

read(*, max_len: int | None = None) str[source]

Get a raw item from the reader.

class cable_club.data.Writer[source]

Bases: object

Format some data to be sent.

add(f: object) None[source]

Add a field to the writer.

add_raw(fs: list[str]) None[source]

Add raw fields to the writer.

static escape(raw: str) str[source]

Escape special symbols in a raw string.

send(client: Client) None[source]

Get data into buffer to be later sent.

send_now(socket: socket) int[source]

Send variable over the wire.