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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: abs-utils
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: AutoBridge Systems Utility Library
5
5
  Author: AutoBridgeSystems
6
6
  Author-email: info@autobridgesystems.com
@@ -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)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "abs-utils"
3
- version = "0.2.1"
3
+ version = "0.2.3"
4
4
  description = "AutoBridge Systems Utility Library"
5
5
  authors = [
6
6
  {name = "AutoBridgeSystems", email = "info@autobridgesystems.com"}
File without changes