heros.serdes

Attributes

Classes

ObjectStore

An object store to be used to keep week references to objects identified by a serializable identifier (int64).

UnserializableRemoteObject

Functions

is_builtin_class_instance(obj)

cbor_default_encoder(encoder, value)

Handle custom types in serialization.

cbor_tag_hook(decoder, tag[, shareable_index])

serialize(obj)

deserialize(bytes)

Module Contents

heros.serdes.ndarray_tag = 4242
heros.serdes.hero_tag = 9000
heros.serdes.unserializable_tag = 9001
heros.serdes.unserializable_object_reference_tag = 9002
heros.serdes.hero_event_tag = 9003
heros.serdes.hero_method_tag = 9004
heros.serdes.is_builtin_class_instance(obj)[source]
class heros.serdes.ObjectStore[source]

An object store to be used to keep week references to objects identified by a serializable identifier (int64).

_cache
add(object: ObjectStore.add.object) int[source]

Add object to store and return it’s identifier

Parameters:

object – object to store

Returns:

Identifier to retrieve the object from the store again

get(identifier: int) object[source]

Retrieve an object identified by :param:identifier from the store. If the object does not exist any more, None is returned.

Parameters:

identifier – the identifier obtained when storing the object

Returns:

object corresponding to the identifier or None if the object does not exist any more

heros.serdes.obj_store
class heros.serdes.UnserializableRemoteObject(type: str, id: int, representation: str)[source]
type
representation
id
__str__()[source]
__repr__()[source]
heros.serdes.cbor_default_encoder(encoder, value)[source]

Handle custom types in serialization.

heros.serdes.cbor_tag_hook(decoder, tag, shareable_index=None)[source]
heros.serdes.serialize(obj)[source]
heros.serdes.deserialize(bytes)[source]