How to use camel to serialize objects. From https://eev.ee/blog/2015/10/15/dont-use-pickle-use-camel/
# v1: tables are always square
class Table(object):
def __init__(self, size):
self.size = size
from camel import CamelRegistry
my_types = CamelRegistry()
@my_types.dumper(Table, 'table', version=1)
def _dump_table(table):
return dict(
size=table.size,
)
@my_types.loader('table', version=1)
def _load_table(data, version):
return Table(data["size"])