atk-common 1.44.0__tar.gz → 1.46.0__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.
Files changed (57) hide show
  1. {atk_common-1.44.0 → atk_common-1.46.0}/PKG-INFO +1 -1
  2. {atk_common-1.44.0 → atk_common-1.46.0}/setup.py +1 -1
  3. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/__init__.py +2 -0
  4. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/__init__.py +4 -0
  5. atk_common-1.46.0/src/atk_common/enums/command_type_enum.py +13 -0
  6. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/encryption_type_enum.py +1 -1
  7. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/file_exists_enum.py +2 -2
  8. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/image_part_type_enum.py +2 -2
  9. atk_common-1.46.0/src/atk_common/enums/image_shelf_type.py +5 -0
  10. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/metering_direction_enum.py +2 -2
  11. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/process_status_type_enum.py +1 -1
  12. atk_common-1.46.0/src/atk_common/enums/test_image_type_enum.py +7 -0
  13. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/http_response_utils.py +1 -1
  14. atk_common-1.46.0/src/atk_common/mq_utils.py +25 -0
  15. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common.egg-info/PKG-INFO +1 -1
  16. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common.egg-info/SOURCES.txt +2 -0
  17. atk_common-1.44.0/src/atk_common/enums/command_type_enum.py +0 -13
  18. atk_common-1.44.0/src/atk_common/mq_utils.py +0 -0
  19. {atk_common-1.44.0 → atk_common-1.46.0}/README.md +0 -0
  20. {atk_common-1.44.0 → atk_common-1.46.0}/license.txt +0 -0
  21. {atk_common-1.44.0 → atk_common-1.46.0}/pyproject.toml +0 -0
  22. {atk_common-1.44.0 → atk_common-1.46.0}/setup.cfg +0 -0
  23. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/datetime_utils.py +0 -0
  24. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/db_utils.py +0 -0
  25. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/docker_utils.py +0 -0
  26. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/api_error_type_enum.py +0 -0
  27. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/camera_cabinet_type_enum.py +0 -0
  28. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/camera_role_enum.py +0 -0
  29. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/certificate_issuer_enum.py +0 -0
  30. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/command_status_type_enum.py +0 -0
  31. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/detection_status_type_enum.py +0 -0
  32. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/history_status_type_enum.py +0 -0
  33. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/image_encoding_type_enum.py +0 -0
  34. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/image_part_category_enum.py +0 -0
  35. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/piezo_vehicle_type_enum.py +0 -0
  36. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/response_status_type_enum.py +0 -0
  37. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/section_role_enum.py +0 -0
  38. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/sensor_order_enum.py +0 -0
  39. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/sensor_type_enum.py +0 -0
  40. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/speed_control_status_type_enum.py +0 -0
  41. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/enums/violation_type_enum.py +0 -0
  42. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/env_utils.py +0 -0
  43. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/error_utils.py +0 -0
  44. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/file_utils.py +0 -0
  45. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/hash_utils.py +0 -0
  46. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/http_utils.py +0 -0
  47. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/internal_response_utils.py +0 -0
  48. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/log_utils.py +0 -0
  49. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common/rabbitmq_consumer.py +0 -0
  50. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common.egg-info/dependency_links.txt +0 -0
  51. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common.egg-info/requires.txt +0 -0
  52. {atk_common-1.44.0 → atk_common-1.46.0}/src/atk_common.egg-info/top_level.txt +0 -0
  53. {atk_common-1.44.0 → atk_common-1.46.0}/src/shared_python_atk_enforcement/__init__.py +0 -0
  54. {atk_common-1.44.0 → atk_common-1.46.0}/tests/test_docker_utils.py +0 -0
  55. {atk_common-1.44.0 → atk_common-1.46.0}/tests/test_error_utils.py +0 -0
  56. {atk_common-1.44.0 → atk_common-1.46.0}/tests/test_http_utils.py +0 -0
  57. {atk_common-1.44.0 → atk_common-1.46.0}/tests/test_log_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atk_common
3
- Version: 1.44.0
3
+ Version: 1.46.0
4
4
  Summary: ATK common methods
5
5
  Home-page: https://github.com/pypa/atk_common
6
6
  Author: Roger
@@ -36,7 +36,7 @@ setup(
36
36
  # For a discussion on single-sourcing the version across setup.py and the
37
37
  # project code, see
38
38
  # https://packaging.python.org/guides/single-sourcing-package-version/
39
- version="1.44.0", # Required
39
+ version="1.46.0", # Required
40
40
  # This is a one-line description or tagline of what your project does. This
41
41
  # corresponds to the "Summary" metadata field:
42
42
  # https://packaging.python.org/specifications/core-metadata/#summary
@@ -10,6 +10,7 @@ from atk_common.http_utils import is_http_status_ok, is_http_status_internal, ge
10
10
  from atk_common.internal_response_utils import create_response, is_response_ok, is_response_http, is_response_internal
11
11
  from atk_common.file_utils import get_image_file_type
12
12
  from atk_common.log_utils import add_log_item, add_log_item_http
13
+ from atk_common.mq_utils import decode_message
13
14
  from atk_common.rabbitmq_consumer import RabbitMQConsumer
14
15
 
15
16
  __all__ = [
@@ -43,6 +44,7 @@ __all__ = [
43
44
  'get_image_file_type',
44
45
  'add_log_item',
45
46
  'add_log_item_http',
47
+ 'decode_message',
46
48
  'RabbitMQConsumer',
47
49
  'get_current_container_info',
48
50
  ]
@@ -12,6 +12,7 @@ from atk_common.enums.history_status_type_enum import HistoryStatusType
12
12
  from atk_common.enums.image_encoding_type_enum import ImageEncodingType
13
13
  from atk_common.enums.image_part_category_enum import ImagePartCategory
14
14
  from atk_common.enums.image_part_type_enum import ImagePartType
15
+ from atk_common.enums.image_shelf_type import ImageShelfType
15
16
  from atk_common.enums.metering_direction_enum import MeteringDirection
16
17
  from atk_common.enums.piezo_vehicle_type_enum import PiezoVehicleType
17
18
  from atk_common.enums.process_status_type_enum import ProcessStatusType
@@ -20,6 +21,7 @@ from atk_common.enums.section_role_enum import SectionRole
20
21
  from atk_common.enums.sensor_order_enum import SensorOrder
21
22
  from atk_common.enums.sensor_type_enum import SensorType
22
23
  from atk_common.enums.speed_control_status_type_enum import SpeedControlStatusType
24
+ from atk_common.enums.test_image_type_enum import TestImageType
23
25
  from atk_common.enums.violation_type_enum import ViolationType
24
26
 
25
27
  __all__ = [
@@ -36,6 +38,7 @@ __all__ = [
36
38
  'ImageEncodingType',
37
39
  'ImagePartCategory',
38
40
  'ImagePartType',
41
+ 'ImageShelfType',
39
42
  'MeteringDirection',
40
43
  'PiezoVehicleType',
41
44
  'ProcessStatusType',
@@ -44,5 +47,6 @@ __all__ = [
44
47
  'SensorOrder',
45
48
  'SensorType',
46
49
  'SpeedControlStatusType',
50
+ 'TestImageType',
47
51
  'ViolationType',
48
52
  ]
@@ -0,0 +1,13 @@
1
+ from enum import Enum
2
+
3
+ class CommandType(Enum):
4
+ POINT_ENFORCEMENT = 1
5
+ SECTION_ENFORCEMENT = 2
6
+ LOCATION_CONFIG = 3
7
+ PING = 4
8
+ CAPTURE_IMAGE = 5
9
+ GETLAST_IMAGE = 6
10
+ GETNEXT_IMAGE = 7
11
+ WRITE_CAMERA_AUX = 8
12
+ STOP_ENFORCEMENTS = 9
13
+ RESTART_CAMERA = 10
@@ -2,4 +2,4 @@ from enum import Enum
2
2
 
3
3
  class EncryptionType(Enum):
4
4
  NONE = 1
5
- X25519AESGCM = 2
5
+ X25519_AES_GCM = 2
@@ -1,5 +1,5 @@
1
1
  from enum import Enum
2
2
 
3
3
  class FileExists(Enum):
4
- FILEEXIST = 1
5
- FILENOTEXIST = 2
4
+ FILE_EXIST = 1
5
+ FILE_NOT_EXIST = 2
@@ -1,6 +1,6 @@
1
1
  from enum import Enum
2
2
 
3
3
  class ImagePartType(Enum):
4
- LICENSEPLATE = 1
4
+ LICENSE_PLATE = 1
5
5
  DRIVER = 2
6
- PHOTOZONE = 3
6
+ PHOTO_ZONE = 3
@@ -0,0 +1,5 @@
1
+ from enum import Enum
2
+
3
+ class ImageShelfType(Enum):
4
+ TOP = 1
5
+ BOTTOM = 2
@@ -1,5 +1,5 @@
1
1
  from enum import Enum
2
2
 
3
3
  class MeteringDirection(Enum):
4
- WITHMETERING = 1
5
- AGAINSTMETERING = 2
4
+ WITH_METERING = 1
5
+ AGAINST_METERING = 2
@@ -5,4 +5,4 @@ class ProcessStatusType(Enum):
5
5
  STARTED = 2
6
6
  FINALIZED = 3
7
7
  LOCKED = 4
8
- NOTAPPROVED = 5
8
+ NOT_APPROVED = 5
@@ -0,0 +1,7 @@
1
+ from enum import Enum
2
+
3
+ class TestImageType(Enum):
4
+ CAPTURE_IMAGE = 1
5
+ GETLAST_IMAGE = 2
6
+ GETNEXT_IMAGE = 3
7
+ EXAMPLE = 4
@@ -21,6 +21,6 @@ def http_response(method, response, container_info):
21
21
  )
22
22
  if is_http_status_internal(response['statusCode']):
23
23
  if is_response_http(response):
24
- resend_error_entity(response['responseMsg'])
24
+ return resend_error_entity(response['responseMsg'])
25
25
  return get_error_entity(response['responseMsg'], method, ApiErrorType.INTERNAL, response['statusCode'], container_info)
26
26
  return get_error_entity(response['responseMsg'], method, ApiErrorType.CONNECTION, response['statusCode'], container_info)
@@ -0,0 +1,25 @@
1
+ import json
2
+ from atk_common.error_utils import get_message
3
+ from atk_common.log_utils import add_log_item
4
+
5
+ def decode_message(body, message):
6
+ import gzip
7
+ import msgpack
8
+ try:
9
+ content_encoding = message.headers.get('content_encoding')
10
+ if content_encoding is not None and content_encoding == 'gzip':
11
+ body = gzip.decompress(body)
12
+ if message.content_type == 'application/json':
13
+ return body
14
+ elif message.content_type == 'application/octet-stream':
15
+ return body
16
+ elif message.content_type == 'application/x-msgpack' or message.content_type == 'application/msgpack':
17
+ return msgpack.unpackb(body, raw=False)
18
+ elif message.content_type.startswith('text/'):
19
+ return body.decode('utf-8')
20
+ else:
21
+ add_log_item('Unknown message content type')
22
+ return None
23
+ except Exception as error:
24
+ add_log_item('Error decoding message: ' + get_message(error))
25
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atk_common
3
- Version: 1.44.0
3
+ Version: 1.46.0
4
4
  Summary: ATK common methods
5
5
  Home-page: https://github.com/pypa/atk_common
6
6
  Author: Roger
@@ -36,6 +36,7 @@ src/atk_common/enums/history_status_type_enum.py
36
36
  src/atk_common/enums/image_encoding_type_enum.py
37
37
  src/atk_common/enums/image_part_category_enum.py
38
38
  src/atk_common/enums/image_part_type_enum.py
39
+ src/atk_common/enums/image_shelf_type.py
39
40
  src/atk_common/enums/metering_direction_enum.py
40
41
  src/atk_common/enums/piezo_vehicle_type_enum.py
41
42
  src/atk_common/enums/process_status_type_enum.py
@@ -44,6 +45,7 @@ src/atk_common/enums/section_role_enum.py
44
45
  src/atk_common/enums/sensor_order_enum.py
45
46
  src/atk_common/enums/sensor_type_enum.py
46
47
  src/atk_common/enums/speed_control_status_type_enum.py
48
+ src/atk_common/enums/test_image_type_enum.py
47
49
  src/atk_common/enums/violation_type_enum.py
48
50
  src/shared_python_atk_enforcement/__init__.py
49
51
  tests/test_docker_utils.py
@@ -1,13 +0,0 @@
1
- from enum import Enum
2
-
3
- class CommandType(Enum):
4
- POINTENFORCEMENT = 1
5
- SECTIONENFORCEMENT = 2
6
- LOCATIONCONFIG = 3
7
- PING = 4
8
- CAPTUREIMAGE = 5
9
- GETLASTIMAGE = 6
10
- GETNEXTIMAGE = 7
11
- WRITECAMERAAUX = 8
12
- STOPENFORCEMENTS = 9
13
- RESTARTCAMERA = 10
File without changes
File without changes
File without changes
File without changes
File without changes