xaal.lib 0.7.3__py3-none-any.whl → 0.7.5__py3-none-any.whl

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/cbor.py CHANGED
@@ -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._decoder.semantic_decoders.pop(37)
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,object_hook=object_hook,**kwargs)
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):
xaal/lib/messages.py CHANGED
@@ -210,7 +210,7 @@ class MessageFactory(object):
210
210
  class MessageType(Enum):
211
211
  NOTIFY = 0
212
212
  REQUEST = 1
213
- REPLY = 2
213
+ REPLY = 2
214
214
 
215
215
 
216
216
  class MessageAction(Enum):
@@ -323,8 +323,8 @@ def build_nonce(data):
323
323
 
324
324
  def build_timestamp():
325
325
  """Return array [seconds since epoch, microseconds since last seconds] Time = UTC+0000"""
326
- epoch = datetime.datetime.utcfromtimestamp(0)
327
- timestamp = datetime.datetime.utcnow() - epoch
326
+ epoch = datetime.datetime.fromtimestamp(0, datetime.UTC)
327
+ timestamp = datetime.datetime.now(datetime.UTC) - epoch
328
328
  return _packtimestamp(timestamp.total_seconds(), timestamp.microseconds)
329
329
 
330
330
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xaal.lib
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: Official Python stack for xAAL protocol
5
5
  Author-email: Jerome Kerdreux <Jerome.Kerdreux@imt-atlantique.fr>
6
6
  License: GPL License
@@ -5,18 +5,18 @@ xaal/lib/aioengine.py,sha256=3MTG9aGKekVvsWhYaehZqZem6YmPng4UqGfDoRTaC2E,13100
5
5
  xaal/lib/aiohelpers.py,sha256=2a310wSXzbg9SGYzrTfcHbaZ8PWEe9rLteDmS2i62kU,1007
6
6
  xaal/lib/aionetwork.py,sha256=pH-5kf8o4FHsbvs-oFf5guAgYaEu0aosyTuI3k8xt2M,2484
7
7
  xaal/lib/bindings.py,sha256=EkDJJ_iBQbC7UzsjHfoXAjpGSwC613hrIm5ubrkcw4k,1994
8
- xaal/lib/cbor.py,sha256=2t9ndDLd1vdW3NJk9itE0vmIXWShj3FFiKVNoXSCAio,1772
8
+ xaal/lib/cbor.py,sha256=yOTAo3TBO7m8KU_ffccJdOZmiJF5tfY7H8nC1XfMIS8,1630
9
9
  xaal/lib/config.py,sha256=jNAEXCswWsKrVab3hycupQn4aYt4c61eq628ow_I2ZI,1736
10
10
  xaal/lib/core.py,sha256=VfaisNREUse-zMrilJuKf6NLVO9HugL1U_I4M7BFzKQ,10806
11
11
  xaal/lib/devices.py,sha256=ZDNVNVmJ26W2atuNkzB7xtYZQAT3dWTrQCvMCDMSVWA,9574
12
12
  xaal/lib/engine.py,sha256=p2of6IPQB0It0RNu5fkJHHp615K_2rgzHfuWOpvJ6Is,7539
13
13
  xaal/lib/exceptions.py,sha256=ZKDKGlm_F48K_0NlaV1fa0Z-a4ZnOxT7NU8c8MKSJAc,504
14
14
  xaal/lib/helpers.py,sha256=mXxVxv7fTV9O9xO1BROhVYBTmdviMl6qx3Il8q1ox8w,2679
15
- xaal/lib/messages.py,sha256=cLwplLp_0qmlgZi6ByohvLEcmuxpWK7liE5dpqyV9AM,11552
15
+ xaal/lib/messages.py,sha256=W7RdHOtX_DT0bCeJAzs0p4KkU5KXofZUCMQYQsOuFF8,11571
16
16
  xaal/lib/network.py,sha256=3HWuQ0afQ-X6_-En2rFeqYJ0Scy5IEHfd0qTldxxCFo,3130
17
17
  xaal/lib/test.py,sha256=laVbgG4HtQquxDzixAG-Cka-HO4kpb7YUsLL267mGPU,3006
18
18
  xaal/lib/tools.py,sha256=SnXmOkeTd4eTN8yWn-GyCkV5mYiG-MX4hkF39KnogLE,3841
19
- xaal.lib-0.7.3.dist-info/METADATA,sha256=ALJzra6dw0iAj569z5Dj_tXD96a0o8z7F3y3IPMhNc8,3809
20
- xaal.lib-0.7.3.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
21
- xaal.lib-0.7.3.dist-info/top_level.txt,sha256=UZ2WDkN02ztkh1OrsjrW8Kmj4n3WqC0BQxaEYOYfWa0,5
22
- xaal.lib-0.7.3.dist-info/RECORD,,
19
+ xaal.lib-0.7.5.dist-info/METADATA,sha256=Rgz65jLN7oCAKVY6YPcMNDdal4Dnz4dTGiy2epRMWkE,3809
20
+ xaal.lib-0.7.5.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
21
+ xaal.lib-0.7.5.dist-info/top_level.txt,sha256=UZ2WDkN02ztkh1OrsjrW8Kmj4n3WqC0BQxaEYOYfWa0,5
22
+ xaal.lib-0.7.5.dist-info/RECORD,,