python3-commons 0.0.15__tar.gz → 0.0.17__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.

Potentially problematic release.


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

Files changed (40) hide show
  1. {python3-commons-0.0.15/src/python3_commons.egg-info → python3-commons-0.0.17}/PKG-INFO +1 -1
  2. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/helpers.py +7 -0
  3. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/serializers.py +1 -7
  4. {python3-commons-0.0.15 → python3-commons-0.0.17/src/python3_commons.egg-info}/PKG-INFO +1 -1
  5. {python3-commons-0.0.15 → python3-commons-0.0.17}/.coveragerc +0 -0
  6. {python3-commons-0.0.15 → python3-commons-0.0.17}/.github/workflows/python-publish.yaml +0 -0
  7. {python3-commons-0.0.15 → python3-commons-0.0.17}/.gitignore +0 -0
  8. {python3-commons-0.0.15 → python3-commons-0.0.17}/AUTHORS.rst +0 -0
  9. {python3-commons-0.0.15 → python3-commons-0.0.17}/CHANGELOG.rst +0 -0
  10. {python3-commons-0.0.15 → python3-commons-0.0.17}/LICENSE +0 -0
  11. {python3-commons-0.0.15 → python3-commons-0.0.17}/README.md +0 -0
  12. {python3-commons-0.0.15 → python3-commons-0.0.17}/README.rst +0 -0
  13. {python3-commons-0.0.15 → python3-commons-0.0.17}/docs/Makefile +0 -0
  14. {python3-commons-0.0.15 → python3-commons-0.0.17}/docs/_static/.gitignore +0 -0
  15. {python3-commons-0.0.15 → python3-commons-0.0.17}/docs/authors.rst +0 -0
  16. {python3-commons-0.0.15 → python3-commons-0.0.17}/docs/changelog.rst +0 -0
  17. {python3-commons-0.0.15 → python3-commons-0.0.17}/docs/conf.py +0 -0
  18. {python3-commons-0.0.15 → python3-commons-0.0.17}/docs/index.rst +0 -0
  19. {python3-commons-0.0.15 → python3-commons-0.0.17}/docs/license.rst +0 -0
  20. {python3-commons-0.0.15 → python3-commons-0.0.17}/pyproject.toml +0 -0
  21. {python3-commons-0.0.15 → python3-commons-0.0.17}/requirements.txt +0 -0
  22. {python3-commons-0.0.15 → python3-commons-0.0.17}/requirements_dev.txt +0 -0
  23. {python3-commons-0.0.15 → python3-commons-0.0.17}/setup.cfg +0 -0
  24. {python3-commons-0.0.15 → python3-commons-0.0.17}/setup.py +0 -0
  25. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/__init__.py +0 -0
  26. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/conf.py +0 -0
  27. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/db.py +0 -0
  28. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/fs.py +0 -0
  29. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/json.py +0 -0
  30. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/logging/__init__.py +0 -0
  31. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/logging/filters.py +0 -0
  32. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/logging/formatter.py +0 -0
  33. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/minio.py +0 -0
  34. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons/object_storage.py +0 -0
  35. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons.egg-info/SOURCES.txt +0 -0
  36. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons.egg-info/dependency_links.txt +0 -0
  37. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons.egg-info/not-zip-safe +0 -0
  38. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons.egg-info/requires.txt +0 -0
  39. {python3-commons-0.0.15 → python3-commons-0.0.17}/src/python3_commons.egg-info/top_level.txt +0 -0
  40. {python3-commons-0.0.15 → python3-commons-0.0.17}/tests/conftest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python3-commons
3
- Version: 0.0.15
3
+ Version: 0.0.17
4
4
  Summary: Re-usable Python3 code
5
5
  Home-page: https://github.com/kamikaze/python3-commons
6
6
  Author: Oleg Korsak
@@ -1,6 +1,9 @@
1
1
  import datetime
2
2
  import logging
3
3
 
4
+ from decimal import Decimal, ROUND_HALF_UP
5
+
6
+
4
7
  logger = logging.getLogger(__name__)
5
8
 
6
9
 
@@ -37,3 +40,7 @@ def tries(times):
37
40
  return wrapper
38
41
 
39
42
  return func_wrapper
43
+
44
+
45
+ def round_decimal(value: Decimal, decimal_places=2, rounding_mode=ROUND_HALF_UP):
46
+ return value.quantize(Decimal(10) ** -decimal_places, rounding=rounding_mode)
@@ -29,10 +29,7 @@ def msgpack_decoder(code, data):
29
29
  def serialize_msgpack(data) -> bytes:
30
30
  logger.debug('Serializing to msgpack', extra={'data': data})
31
31
 
32
- if isinstance(data, dict):
33
- result = msgpack.packb({k: serialize_msgpack(v) for k, v in data.items()}, default=msgpack_encoder)
34
- else:
35
- result = msgpack.packb(data, default=msgpack_encoder)
32
+ result = msgpack.packb(data, default=msgpack_encoder)
36
33
 
37
34
  logger.debug('Serialized to msgpack', extra={'result': result})
38
35
 
@@ -44,9 +41,6 @@ def deserialize_msgpack(data: bytes):
44
41
 
45
42
  result = msgpack.unpackb(data, ext_hook=msgpack_decoder)
46
43
 
47
- if isinstance(result, dict):
48
- result = {k: deserialize_msgpack(v) for k, v in result.items()}
49
-
50
44
  logger.debug('De-serialized from msgpack', extra={'result': result})
51
45
 
52
46
  return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python3-commons
3
- Version: 0.0.15
3
+ Version: 0.0.17
4
4
  Summary: Re-usable Python3 code
5
5
  Home-page: https://github.com/kamikaze/python3-commons
6
6
  Author: Oleg Korsak