Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
>>> blob = Blob(b'content')
>>> serialize_object(blob) == blob
True
.. warning::
There is no guarantee this is in sync with hippiehug, i.e., this
is the serialization hippiehug employs internally. This will eventually
move inside the hippiehug library.
"""
if isinstance(obj, hippiehug.Nodes.Leaf):
return (obj.key, obj.item)
elif isinstance(obj, hippiehug.Nodes.Branch):
return (obj.pivot, obj.left_branch, obj.right_branch)
elif isinstance(obj, hippiehug.Block):
return (obj.index, obj.fingers, obj.items, obj.aux)
elif isinstance(obj, Blob):
return obj