xaal.lib 0.7.3__tar.gz → 0.7.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/PKG-INFO +1 -1
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/pyproject.toml +1 -1
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/cbor.py +7 -13
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal.lib.egg-info/PKG-INFO +1 -1
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/README.rst +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/setup.cfg +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/tests/test_bindings.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/tests/test_cbor.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/tests/test_device.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/tests/test_engine.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/tests/test_message.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/tests/test_tools.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/__init__.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/__init__.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/__main__.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/aioengine.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/aiohelpers.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/aionetwork.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/bindings.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/config.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/core.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/devices.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/engine.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/exceptions.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/helpers.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/messages.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/network.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/test.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal/lib/tools.py +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal.lib.egg-info/SOURCES.txt +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal.lib.egg-info/dependency_links.txt +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal.lib.egg-info/requires.txt +0 -0
- {xaal_lib-0.7.3 → xaal_lib-0.7.4}/xaal.lib.egg-info/top_level.txt +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
from io import BytesIO
|
|
2
2
|
import cbor2
|
|
3
3
|
from cbor2 import CBORTag
|
|
4
|
-
from cbor2 import CBORDecoder
|
|
5
|
-
# from cbor2.decoder import CBORDecoder
|
|
4
|
+
from cbor2.decoder import CBORDecoder
|
|
6
5
|
|
|
7
6
|
from . import bindings
|
|
8
7
|
|
|
9
8
|
# ugly patch to remove default UUID decodeur
|
|
10
|
-
cbor2.
|
|
9
|
+
cbor2.decoder.semantic_decoders.pop(37)
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
def tag_hook(decoder, tag, shareable_index=None):
|
|
@@ -17,11 +16,6 @@ def tag_hook(decoder, tag, shareable_index=None):
|
|
|
17
16
|
return bindings.URL(tag.value)
|
|
18
17
|
return tag
|
|
19
18
|
|
|
20
|
-
def object_hook(decoder, data):
|
|
21
|
-
#print("hook [%s]" % data)
|
|
22
|
-
return data
|
|
23
|
-
|
|
24
|
-
|
|
25
19
|
def default_encoder(encoder, value):
|
|
26
20
|
if isinstance(value,bindings.UUID):
|
|
27
21
|
encoder.encode(CBORTag(37, value.bytes))
|
|
@@ -34,7 +28,7 @@ def dumps(obj, **kwargs):
|
|
|
34
28
|
|
|
35
29
|
def loads(payload, **kwargs):
|
|
36
30
|
#return cbor2.loads(payload,tag_hook=tag_hook,**kwargs)
|
|
37
|
-
return _loads(payload,tag_hook=tag_hook
|
|
31
|
+
return _loads(payload,tag_hook=tag_hook,**kwargs)
|
|
38
32
|
|
|
39
33
|
def _loads(s, **kwargs):
|
|
40
34
|
with BytesIO(s) as fp:
|
|
@@ -44,16 +38,16 @@ def _loads(s, **kwargs):
|
|
|
44
38
|
|
|
45
39
|
|
|
46
40
|
def cleanup(obj):
|
|
47
|
-
"""
|
|
41
|
+
"""
|
|
48
42
|
recursive walk a object to search for un-wanted CBOR tags.
|
|
49
43
|
Transform this tag in string format, this can be UUID, URL..
|
|
50
|
-
Should be Ok, with list, dicts..
|
|
51
|
-
Warning: This operate in-place changes.
|
|
44
|
+
Should be Ok, with list, dicts..
|
|
45
|
+
Warning: This operate in-place changes.
|
|
52
46
|
Warning: This won't work for tags in dict keys.
|
|
53
47
|
"""
|
|
54
48
|
if isinstance(obj,list):
|
|
55
49
|
for i in range(0,len(obj)):
|
|
56
|
-
obj[i] = cleanup(obj[i])
|
|
50
|
+
obj[i] = cleanup(obj[i])
|
|
57
51
|
return obj
|
|
58
52
|
|
|
59
53
|
if isinstance(obj,dict):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|