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)
class heros.serdes.ObjectStore

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

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

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)
type
representation
id
__str__()
__repr__()
heros.serdes.cbor_default_encoder(encoder, value)

Handle custom types in serialization.

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