python3-commons 0.6.6__py3-none-any.whl → 0.6.7__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.
@@ -7,7 +7,7 @@ from datetime import datetime, date
7
7
  from typing import Any
8
8
 
9
9
  from msgspec import msgpack
10
- from msgspec.msgpack import Ext
10
+ from msgspec.msgpack import encode, Ext
11
11
 
12
12
  from python3_commons.serializers.json import CustomJSONEncoder
13
13
 
@@ -42,6 +42,20 @@ def ext_hook(code: int, data: memoryview) -> Any:
42
42
 
43
43
  MSGPACK_ENCODER = msgpack.Encoder(enc_hook=enc_hook)
44
44
  MSGPACK_DECODER = msgpack.Decoder(ext_hook=ext_hook)
45
+ MSGPACK_DECODER_NATIVE = msgpack.Decoder()
46
+
47
+
48
+ def serialize_msgpack_native(data) -> bytes:
49
+ return encode(data)
50
+
51
+
52
+ def deserialize_msgpack_native(data: bytes, data_type=None):
53
+ if data_type:
54
+ result = msgpack.decode(data, type=data_type)
55
+ else:
56
+ result = MSGPACK_DECODER_NATIVE.decode(data)
57
+
58
+ return result
45
59
 
46
60
 
47
61
  def serialize_msgpack(data) -> bytes:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: python3-commons
3
- Version: 0.6.6
3
+ Version: 0.6.7
4
4
  Summary: Re-usable Python3 code
5
5
  Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
6
6
  License: gpl-3
@@ -12,10 +12,10 @@ python3_commons/logging/formatters.py,sha256=UXmmh1yd5Kc2dpvSHn6uCWLDWE2LMjlYAaH
12
12
  python3_commons/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  python3_commons/serializers/json.py,sha256=P288wWz9ic38QWEMrpp_uwKPYkQiOgvE1cI4WZn6ZCg,808
14
14
  python3_commons/serializers/msgpack.py,sha256=tzIGGyDL3UpZnnouCtnxuYDx6InKM_C3PP1N4PN8wd4,1269
15
- python3_commons/serializers/msgspec.py,sha256=EknuMpxi_kU25Iv_m10E9rk8b31AkjVumuzyjp7WgrU,1699
16
- python3_commons-0.6.6.dist-info/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
17
- python3_commons-0.6.6.dist-info/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
18
- python3_commons-0.6.6.dist-info/METADATA,sha256=eOUGce_BxontqiZr8VFRgHusCvPfTbS2sZOisGdrKzQ,985
19
- python3_commons-0.6.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
20
- python3_commons-0.6.6.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
21
- python3_commons-0.6.6.dist-info/RECORD,,
15
+ python3_commons/serializers/msgspec.py,sha256=FuZVqOLJb0-lEKrs7dtjhwEbHIpfMUk5yu1hD64zRdc,2038
16
+ python3_commons-0.6.7.dist-info/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
17
+ python3_commons-0.6.7.dist-info/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
18
+ python3_commons-0.6.7.dist-info/METADATA,sha256=6L7NNsUmrmT5EOpjKf_dh605zkUZ8ltIMRn-lq0j5ME,985
19
+ python3_commons-0.6.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
20
+ python3_commons-0.6.7.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
21
+ python3_commons-0.6.7.dist-info/RECORD,,