abs-utils 0.2.1__tar.gz → 0.2.3__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.
- {abs_utils-0.2.1 → abs_utils-0.2.3}/PKG-INFO +1 -1
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/azure_service_bus/event_decorator.py +4 -1
- abs_utils-0.2.3/abs_utils/schemas/libs/extend_enum.py +28 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/pyproject.toml +1 -1
- {abs_utils-0.2.1 → abs_utils-0.2.3}/README.md +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/azure_service_bus/__init__.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/azure_service_bus/azure_service_bus.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/constants/__init__.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/constants/endpoint_constants.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/constants/event_constants.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/logger/__init__.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/logger/logger.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/schemas/__init__.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/schemas/fields_schema/__init__.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/schemas/fields_schema/common_schema.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/schemas/fields_schema/field_schema.py +0 -0
- {abs_utils-0.2.1 → abs_utils-0.2.3}/abs_utils/schemas/libs/make_optional.py +0 -0
|
@@ -4,7 +4,7 @@ from typing import Any, Callable
|
|
|
4
4
|
from .azure_service_bus import AzureServiceBus
|
|
5
5
|
from uuid import uuid4
|
|
6
6
|
import json
|
|
7
|
-
|
|
7
|
+
from ..constants import ON_RECORD_UPDATION
|
|
8
8
|
def azure_event_decorator(event_type: str):
|
|
9
9
|
"""
|
|
10
10
|
A decorator that sends a message to Azure Service Bus after the function execution.
|
|
@@ -44,6 +44,9 @@ def azure_event_decorator(event_type: str):
|
|
|
44
44
|
|
|
45
45
|
# Execute the original function
|
|
46
46
|
result = await func(*args, **kwargs)
|
|
47
|
+
|
|
48
|
+
if event_type != ON_RECORD_UPDATION:
|
|
49
|
+
data = result
|
|
47
50
|
|
|
48
51
|
event_payload = {
|
|
49
52
|
"event_id": str(uuid4()),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Type, Union, Dict
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def extend_enum(
|
|
6
|
+
name: str,
|
|
7
|
+
base_enum: Type[Enum],
|
|
8
|
+
additional_fields: Union[Dict[str, str], Type[Enum]]
|
|
9
|
+
) -> Type[Enum]:
|
|
10
|
+
"""
|
|
11
|
+
Create a new Enum by extending an existing one with additional fields
|
|
12
|
+
provided either as a dict or another Enum class.
|
|
13
|
+
|
|
14
|
+
:param name: Name of the new Enum
|
|
15
|
+
:param base_enum: The base Enum class to extend
|
|
16
|
+
:param additional_fields: A dict or Enum class with new values
|
|
17
|
+
:return: A new Enum class with combined values
|
|
18
|
+
"""
|
|
19
|
+
base_members = {e.name: e.value for e in base_enum}
|
|
20
|
+
extra_members = {}
|
|
21
|
+
if isinstance(additional_fields, dict):
|
|
22
|
+
extra_members = additional_fields
|
|
23
|
+
elif isinstance(additional_fields, type) and issubclass(additional_fields, Enum):
|
|
24
|
+
extra_members = {e.name: e.value for e in additional_fields}
|
|
25
|
+
|
|
26
|
+
merged_members = {**base_members, **extra_members}
|
|
27
|
+
|
|
28
|
+
return Enum(name, merged_members, type=str)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|