Skip to content
Snippets Groups Projects
Commit 8c5c8877 authored by jkerdreu's avatar jkerdreu
Browse files

Missing commit ?.


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2359 b32b6428-25c9-4566-ad07-03861ab6144f
parent 46821f48
No related branches found
No related tags found
No related merge requests found
import cbor2
from cbor2 import CBORTag,encoder
from . import bindings
# ugly patch to remove default UUID decodeur
cbor2.decoder.semantic_decoders.pop(37)
def tag_hook(decoder, tag, shareable_index=None):
if tag.tag == 37:
return bindings.UUID(bytes=tag.value)
return tag
def default_encoder(encoder, value):
if type(value) == bindings.UUID:
encoder.encode(CBORTag(37, value.bytes))
def dumps(obj, **kwargs):
return cbor2.dumps(obj,default=default_encoder,**kwargs)
def loads(payload, **kwargs):
return cbor2.loads(payload,tag_hook=tag_hook,**kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment