serializer
This module contains the Serializer
that is used to parse incoming network data into Python classes.
Serializer
Deserializes raw bytes into wom.py model classes.
Source code in wom/serializer.py
decode
Decodes the data into the given model type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
The JSON payload as bytes. |
required |
model_type |
Type[T]
|
The type of model to decode into. |
required |
Returns:
Type | Description |
---|---|
T
|
The requested model. |
Source code in wom/serializer.py
get_decoder
Lazily initializes decoders as they are requested and caches them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_type |
Type[T]
|
The model type this decoder will target. |
required |
Returns:
Type | Description |
---|---|
Decoder[T]
|
The requested decoder. |