SharedStateObject

class narupatools.state.state_object.SharedStateObject(**kwargs: Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping])

Base class for an object which is stored in the shared state dictionary.

This stores arbitrary fields of serializable data. Any properties that are defined on a subclass of SharedStateObject are serialized automatically, calling their get and set methods as appropriate.

Inheritance

Inheritance diagram of SharedStateObject

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__(**kwargs: Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping])

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

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

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.

serialize()Dict[str, 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.