SerializableObject

class narupatools.state.serializable_object.SerializableObject(*args, **kwargs)

Protocol for objects which can be converted to and from a serializable form.

Types that are serializable by protobuf consist of primitive types, lists and dictionaries.

Inheritance

Inheritance diagram of SerializableObject

Methods

__init__

Initialize self.

deserialize

Deserialize a given object to an instance of this class.

serialize

Serialize this object to a form that is serializable to protobuf.

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

abstract classmethod deserialize(value: Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping])TClass

Deserialize a given object to an instance of this class.

Keys which share a name with a property will use that property’s setter, whilst other keys will be stored as arbitrary data which can be accessed using an item accessor.

Parameters

value – Object to deserialize to the given object.

abstract serialize()Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping]

Serialize this object to a form that is serializable to protobuf.

All properties and arbitrary data will be writen to the dictionary.