heros.serdes
============

.. py:module:: heros.serdes


Attributes
----------

.. autoapisummary::

   heros.serdes.ndarray_tag
   heros.serdes.hero_tag
   heros.serdes.unserializable_tag
   heros.serdes.unserializable_object_reference_tag
   heros.serdes.hero_event_tag
   heros.serdes.hero_method_tag
   heros.serdes.obj_store


Classes
-------

.. autoapisummary::

   heros.serdes.ObjectStore
   heros.serdes.UnserializableRemoteObject


Functions
---------

.. autoapisummary::

   heros.serdes.is_builtin_class_instance
   heros.serdes.cbor_default_encoder
   heros.serdes.cbor_tag_hook
   heros.serdes.serialize
   heros.serdes.deserialize


Module Contents
---------------

.. py:data:: ndarray_tag
   :value: 4242


.. py:data:: hero_tag
   :value: 9000


.. py:data:: unserializable_tag
   :value: 9001


.. py:data:: unserializable_object_reference_tag
   :value: 9002


.. py:data:: hero_event_tag
   :value: 9003


.. py:data:: hero_method_tag
   :value: 9004


.. py:function:: is_builtin_class_instance(obj)

.. py:class:: ObjectStore

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


   .. py:attribute:: _cache


   .. py:method:: add(object: ObjectStore.add.object) -> int

      Add object to store and return it's identifier

      :param object: object to store

      :returns: Identifier to retrieve the object from the store again



   .. py:method:: 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.

      :param identifier: the identifier obtained when storing the object

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



.. py:data:: obj_store

.. py:class:: UnserializableRemoteObject(type: str, id: int, representation: str)

   .. py:attribute:: type


   .. py:attribute:: representation


   .. py:attribute:: id


   .. py:method:: __str__()


   .. py:method:: __repr__()


.. py:function:: cbor_default_encoder(encoder, value)

   Handle custom types in serialization.


.. py:function:: cbor_tag_hook(decoder, tag, shareable_index=None)

.. py:function:: serialize(obj)

.. py:function:: deserialize(bytes)

