Interpreter
This module contains the Interpreter abstract class and its implementation JSONInterpreter.
CLASS | DESCRIPTION |
---|---|
Interpreter |
Abstract class for encoding and decoding messages. |
JSONInterpreter |
Class for encoding and decoding messages in JSON format. |
Documentation last updated: 2025-06-11
Interpreter
Abstract class for encoding and decoding messages.
METHOD | DESCRIPTION |
---|---|
decodeRequest |
Decode a request message into a command dictionary. |
encodeData |
Encode data into a message. |
encodeRequest |
Encode a command dictionary into a request message. |
decodeData |
Decode a message into data. |
decodeData
staticmethod
Decode a message into data.
PARAMETER | DESCRIPTION |
---|---|
packet
|
message to be decoded
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, Any]
|
dict[str, Any]: decoded data |
decodeRequest
staticmethod
Decode a request message into a command dictionary.
PARAMETER | DESCRIPTION |
---|---|
packet
|
request message to be decoded
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, Any]
|
dict[str, Any]: command dictionary |
encodeData
staticmethod
Encode data into a message.
PARAMETER | DESCRIPTION |
---|---|
data
|
data to be encoded
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bytes
|
encoded message in bytes
TYPE:
|
JSONInterpreter
Bases: Interpreter
Class for encoding and decoding messages in JSON format.
METHOD | DESCRIPTION |
---|---|
decodeRequest |
Decode a request message into a command dictionary. |
encodeData |
Encode data into a message. |
encodeRequest |
Encode a command dictionary into a request message. |
decodeData |
Decode a message into data |
decodeData
staticmethod
Decode a message into data.
PARAMETER | DESCRIPTION |
---|---|
packet
|
message to be decoded
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, Any]
|
dict[str, Any]: decoded data |
decodeRequest
staticmethod
Decode a request message into a command dictionary.
PARAMETER | DESCRIPTION |
---|---|
packet
|
request message
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, Any]
|
dict[str, Any]: command dictionary |
encodeData
staticmethod
Encode data into a message.
PARAMETER | DESCRIPTION |
---|---|
data
|
data to be encoded
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bytes
|
encoded message
TYPE:
|