msgpack
Classes:
-
MsgPackSerializer–A serializer for MessagePack data.
-
MsgPackStreamSerializer–A serializer for MessagePack data.
Attributes:
-
MSG_PACK_TYPES–The types that can be serialized to the MessagePack format.
-
MsgPackType–A type alias for MessagePack data.
-
msgpack_serializer–MsgPackSerializer with default settings.
-
msgpack_stream_serializer–MsgPackStreamSerializer with default settings.
MSG_PACK_TYPES
module-attribute
The types that can be serialized to the MessagePack format.
MsgPackType
module-attribute
MsgPackType = (
Any
| int
| str
| float
| bool
| dict[int | str | float | bool | None, "MsgPackType"]
| list["MsgPackType"]
| None
)
A type alias for MessagePack data.
msgpack_serializer
module-attribute
msgpack_serializer = MsgPackSerializer()
MsgPackSerializer with default settings.
msgpack_stream_serializer
module-attribute
msgpack_stream_serializer = MsgPackStreamSerializer()
MsgPackStreamSerializer with default settings.
MsgPackSerializer
MsgPackSerializer(
*,
packer: Callable[[], Packer] = Packer,
unpacker: Callable[[], Unpacker] = Unpacker
)
Bases: _MsgPackBase, Serializer[MsgPackType]
A serializer for MessagePack data.
Methods:
-
deserialize_config–Deserialize the configuration from a JSON string.
-
deserialize_data–Deserialize the given MessagePack data.
-
serialize_config–Serialize the configuration to a JSON string.
-
serialize_data–Serialize the given value to MessagePack.
Attributes:
-
content_types(tuple[str, ...]) –The content types that the serializer uses.
content_types
class-attribute
instance-attribute
The content types that the serializer uses.
Used to get serializers by content type in the registry.
deserialize_config
deserialize_config(config: str) -> C
Deserialize the configuration from a JSON string.
deserialize_data
deserialize_data(content: SerializedData) -> MsgPackType
Deserialize the given MessagePack data.
serialize_data
serialize_data(value: MsgPackType) -> SerializedData
Serialize the given value to MessagePack.
MsgPackStreamSerializer
MsgPackStreamSerializer(
*,
packer: Callable[[], Packer] = Packer,
unpacker: Callable[[], Unpacker] = Unpacker
)
Bases: _MsgPackBase, StreamSerializer[MsgPackType]
A serializer for MessagePack data.
Methods:
-
deserialize_config–Deserialize the configuration from a JSON string.
-
deserialize_data_stream–Deserialize the given stream of MessagePack data.
-
dump_data–Serialize the given value to MessagePack.
-
load_data–Deserialize the given MessagePack data.
-
serialize_config–Serialize the configuration to a JSON string.
-
serialize_data_stream–Serialize the given stream of MessagePack data.
Attributes:
-
content_types(tuple[str, ...]) –The content types that the serializer uses.
content_types
class-attribute
instance-attribute
The content types that the serializer uses.
Used to get serializers by content type in the registry.
deserialize_config
deserialize_config(config: str) -> C
Deserialize the configuration from a JSON string.
deserialize_data_stream
deserialize_data_stream(
content: SerializedDataStream,
) -> AsyncGenerator[MsgPackType]
Deserialize the given stream of MessagePack data.
dump_data
dump_data(value: Iterable[MsgPackType]) -> SerializedData
Serialize the given value to MessagePack.
load_data
load_data(content: SerializedData) -> list[MsgPackType]
Deserialize the given MessagePack data.
serialize_data_stream
serialize_data_stream(
stream: AsyncIterable[MsgPackType],
) -> SerializedDataStream
Serialize the given stream of MessagePack data.