python3-commons 0.0.18__py2.py3-none-any.whl → 0.0.20__py2.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.

Potentially problematic release.


This version of python3-commons might be problematic. Click here for more details.

@@ -1,4 +1,5 @@
1
1
  import logging
2
+ from datetime import datetime, date
2
3
  from decimal import Decimal
3
4
 
4
5
  import msgpack
@@ -13,6 +14,10 @@ def msgpack_encoder(obj):
13
14
 
14
15
  if isinstance(obj, Decimal):
15
16
  return ExtType(1, str(obj).encode())
17
+ elif isinstance(obj, datetime):
18
+ return ExtType(2, obj.isoformat().encode())
19
+ elif isinstance(obj, date):
20
+ return ExtType(3, obj.isoformat().encode())
16
21
 
17
22
  return f'no encoder for {obj}'
18
23
 
@@ -22,6 +27,10 @@ def msgpack_decoder(code, data):
22
27
 
23
28
  if code == 1:
24
29
  return Decimal(data.decode())
30
+ elif code == 2:
31
+ return datetime.fromisoformat(data.decode())
32
+ elif code == 3:
33
+ return date.fromisoformat(data.decode())
25
34
 
26
35
  return f'no decoder for type {code}'
27
36
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python3-commons
3
- Version: 0.0.18
3
+ Version: 0.0.20
4
4
  Summary: Re-usable Python3 code
5
5
  Home-page: https://github.com/kamikaze/python3-commons
6
6
  Author: Oleg Korsak
@@ -6,13 +6,13 @@ python3_commons/helpers.py,sha256=wI7afc-8o-SBpLBHQnWXiudw456EAVKguJaeZiSNXwE,13
6
6
  python3_commons/json.py,sha256=JIVQvw2COzskHqmufae1faX9vKrcvromoQZx0zl9gKs,698
7
7
  python3_commons/minio.py,sha256=R6o_yIpoK7SlSWI4jSsgZZF3kwYbTeD9FejGADqo87E,819
8
8
  python3_commons/object_storage.py,sha256=AdGbZYA-UaetunIaPdCTQNSVGgbwItU2JjSEUXFbWRA,1724
9
- python3_commons/serializers.py,sha256=DovymeDcDnBbbV4w0AlBmEyaAEXq4MSE1h1OGtyxE2c,1048
9
+ python3_commons/serializers.py,sha256=0nr3WhKwe2XsnHa6zDv52dHnMKroLz9YCmXdBKMmaOU,1398
10
10
  python3_commons/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  python3_commons/logging/filters.py,sha256=fuyjXZAUm-i2MNrxvFYag8F8Rr27x8W8MdV3ke6miSs,175
12
12
  python3_commons/logging/formatter.py,sha256=TPTKNv8FEqyQj0ZHbrgG-_awbUOa53FO0nXUPsKvy3o,498
13
- python3_commons-0.0.18.dist-info/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
14
- python3_commons-0.0.18.dist-info/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
15
- python3_commons-0.0.18.dist-info/METADATA,sha256=pT2sqN_GA1uzEJ6pJ61DOOP3MlM9rANCP6XYw-PtrKY,902
16
- python3_commons-0.0.18.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
17
- python3_commons-0.0.18.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
18
- python3_commons-0.0.18.dist-info/RECORD,,
13
+ python3_commons-0.0.20.dist-info/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
14
+ python3_commons-0.0.20.dist-info/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
15
+ python3_commons-0.0.20.dist-info/METADATA,sha256=9v9jN2FF0aRO3i3A9ubMVrENJdWI7khBUbjWCFmeOF4,902
16
+ python3_commons-0.0.20.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
17
+ python3_commons-0.0.20.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
18
+ python3_commons-0.0.20.dist-info/RECORD,,