edri 2025.12.1rc4__py3-none-any.whl → 2025.12.2rc1__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.
@@ -137,8 +137,8 @@ class BaseHandler[T: ResponseDirective](ABC):
137
137
  # Determine underlying class and optional inner type
138
138
  item_type = None
139
139
 
140
- if isinstance(cls, GenericAlias):
141
- origin = get_origin(cls) # e.g. ListValidation
140
+ origin = get_origin(cls)
141
+ if origin is not None:
142
142
  args = get_args(cls) # e.g. (int,)
143
143
  target_cls = origin
144
144
 
@@ -159,6 +159,9 @@ class BaseHandler[T: ResponseDirective](ABC):
159
159
  if k in param_names
160
160
  }
161
161
 
162
+ if origin is not None:
163
+ filtered_params["generics"] = args
164
+
162
165
  # If this is a list-like validator with an inner type -> convert elements first
163
166
  if item_type is not None:
164
167
  if (not isinstance(value, Iterable)) or isinstance(value, (str, bytes)):
@@ -184,22 +184,19 @@ class URLNode:
184
184
 
185
185
  regex_function = cls.DATA_TYPE_REGEX.get(origin)
186
186
  elif isinstance(type_, Injection):
187
- previous_regex = None
188
- for vot in type_.classes:
189
- for base in vot.__mro__[1:]: # Skip the type itself
190
- regex_function = cls.DATA_TYPE_REGEX.get(base)
191
-
192
- if regex_function:
193
- if previous_regex is None:
194
- previous_regex = regex_function
195
- elif previous_regex != regex_function:
196
- raise TypeError("All classes in 'inject' must have the same base class when used as URL parameters.")
197
- break # Only check the first valid base class regex
198
-
199
- if vot is StringValidator:
200
- regex = type_.parameters.get("regex", None)
201
- if regex is not None:
202
- regex_function = lambda name, _: rf"^(?P<{escape(name)}>{sub(r'^\^(.*)\$$', r'\1', regex.pattern)})$"
187
+ if regex := type_.parameters.get("regex"):
188
+ regex_function = lambda name, _: rf"^(?P<{escape(name)}>{sub(r'^\^(.*)\$$', r'\1', regex.pattern)})$"
189
+ else:
190
+ previous_regex = None
191
+ for vot in type_.classes:
192
+ for base in vot.__mro__[1:]: # Skip the type itself
193
+ regex_function = cls.DATA_TYPE_REGEX.get(base)
194
+ if regex_function:
195
+ if previous_regex is None:
196
+ previous_regex = regex_function
197
+ elif previous_regex != regex_function:
198
+ raise TypeError("All classes in 'inject' must have the same base class when used as URL parameters.")
199
+ break # Only check the first valid base class regex
203
200
 
204
201
  elif issubclass(type_, Enum):
205
202
  regex_function = cls.DATA_TYPE_REGEX.get(Enum)
edri/api/listener.py CHANGED
@@ -216,7 +216,7 @@ class Listener(Process):
216
216
  current_exception = e
217
217
  while current_exception:
218
218
  reasons.append({
219
- "message": str(current_exception)
219
+ "message": current_exception.__repr__()
220
220
  })
221
221
  # Move to the next exception in the chain
222
222
  current_exception = current_exception.__context__
@@ -1,6 +1,5 @@
1
1
  from inspect import signature
2
- from types import GenericAlias
3
- from typing import Any, Type, get_origin
2
+ from typing import Any, Type
4
3
 
5
4
 
6
5
  class Injection:
@@ -18,8 +17,6 @@ class Injection:
18
17
  constructor's signature will be passed to the class.
19
18
 
20
19
  Methods:
21
- __iter__: Iterates over the provided classes and creates callables that can instantiate them
22
- with the appropriate parameters.
23
20
  __repr__: Returns a string representation of the Injection instance, showing the classes and
24
21
  the parameters that will be passed to their constructors.
25
22
  """
@@ -29,29 +26,6 @@ class Injection:
29
26
  self.classes = classes # Store the classes
30
27
  self.parameters = parameters # Store the parameters
31
28
 
32
- def __iter__(self):
33
- # Create the callable on demand when iterating
34
- for cls in self.classes:
35
- # Get the signature of the __init__ method of the class
36
- if isinstance(cls, GenericAlias):
37
- sig = signature(get_origin(cls))
38
- else:
39
- sig = signature(cls)
40
- # Extract parameter names from the signature
41
- param_names: list[str] = [param.name for param in sig.parameters.values() if param.name != 'self']
42
-
43
- # Filter the parameters dictionary to include only the ones needed for the class
44
- filtered_params: dict[str, Any] = {k: v for k, v in self.parameters.items() if k in param_names}
45
-
46
- # Create the callable (function) to instantiate the class with the filtered parameters
47
- def create_instance(value: str, cls=cls, filtered_params=filtered_params):
48
- # Here we assume that `value` will be passed to the `__init__` of the class
49
- # This is a simple way to make sure that `value` can be used along with the filtered params
50
- return cls(value, **filtered_params)
51
-
52
- # Yield the callable (this will be used in the iteration)
53
- yield create_instance
54
-
55
29
  def __repr__(self):
56
30
  # Representation of the class, including class names and their filtered parameters
57
31
  param_info = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edri
3
- Version: 2025.12.1rc4
3
+ Version: 2025.12.2rc1
4
4
  Summary: Event Driven Routing Infrastructure
5
5
  Author: Marek Olšan
6
6
  Author-email: marek.olsan@gmail.com
@@ -10,7 +10,7 @@ edri/abstract/worker/worker_process.py,sha256=QiNxOuwkMds0sV2MBLyp7bjrovm5xColC7
10
10
  edri/abstract/worker/worker_thread.py,sha256=xoMPuDn-hAkWk6kFY3Xf8mxOVP__5t7-x7f-b396-8M,2176
11
11
  edri/api/__init__.py,sha256=ZDxCpHKFGajJ1RwDpV7CzxLDUaKpozJRfOCv1OPv5ZY,142
12
12
  edri/api/broker.py,sha256=I3z_bKbcTDnKXk82yteGEQmuxpqHgp5KrhQaJmk3US0,37258
13
- edri/api/listener.py,sha256=8ffX8ntJ5XbHAqT5hM38teMRsd1cBjcJ7PJAMa4Ez7c,20403
13
+ edri/api/listener.py,sha256=vXvLx2agQG43BIaLOnVpu9ATXhLvKon8BVRLCbVRs_Q,20409
14
14
  edri/api/middleware.py,sha256=6_x55swthVDczT-fu_1ufY1cDsHTZ04jMx6J6xfjbsM,5483
15
15
  edri/api/dataclass/__init__.py,sha256=8Y-zcaJtzMdALnNG7M9jsCaB1qAJKM8Ld3h9MDajYjA,292
16
16
  edri/api/dataclass/api_event.py,sha256=08edshexI9FxdebPIgTQMSQ4fEtGpAa3K_VYCmN1jFs,6587
@@ -20,9 +20,9 @@ edri/api/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
20
20
  edri/api/extensions/url_extension.py,sha256=rZKumjR7J6pDTiSLIZf8IzxGgDZP7p2g0Kgs0USug_U,1971
21
21
  edri/api/extensions/url_prefix.py,sha256=kNI6g5ZlW0w-J_IMacYLco1EQvmTtMJyEkN6-SK1wC0,491
22
22
  edri/api/handlers/__init__.py,sha256=MI6OGDf1rM8jf_uCKK_JYeOGMts62CNy10BwwNlG0Tk,200
23
- edri/api/handlers/base_handler.py,sha256=aZN95tWX7hkmJ3D401c-JPfF2azjH0t1jJy_zsjPc_4,13113
23
+ edri/api/handlers/base_handler.py,sha256=4qavJ4XD1BeFq_KjFxj_Mp6PzIhAAFqFfXNrwv8CCtw,13170
24
24
  edri/api/handlers/html_handler.py,sha256=OprcTg1IQDI7eBK-_oHqA60P1H30LA9xIQpD7iV-Neg,7464
25
- edri/api/handlers/http_handler.py,sha256=AC-8oi4ez5LcNfCd-wrkGSc9fLo2fBNw51yEg8MDiPs,36368
25
+ edri/api/handlers/http_handler.py,sha256=jjOyx2Wu756K99x6zvJoybgM2Bj0eWXkjEElLYkCDZ0,36338
26
26
  edri/api/handlers/rest_handler.py,sha256=GAG5lVTsRMCf9IUmYb_pokxyPcOfbnKZ2p3jxfy_-Dw,3300
27
27
  edri/api/handlers/websocket_handler.py,sha256=Dh2XannDuW0eFj5CEzf3owlGc1VTyQ8ehjpxYRrCYW8,8144
28
28
  edri/api/static_pages/documentation.j2,sha256=Fe7KLsbqp9P-pQYqG2z8rbhhGVDDFf3m6SQ2mc3PFG4,8934
@@ -36,7 +36,7 @@ edri/config/setting.py,sha256=kzii_wmx4C8-uE_TNfBvRlJMkpJrvVLXvZam-2pm3eE,2065
36
36
  edri/dataclass/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  edri/dataclass/event.py,sha256=3XwbS_8Nst0V5D6vQ0FYhrX5rx6KfLGd3-9ba71xUMQ,9866
38
38
  edri/dataclass/health_checker.py,sha256=62H5wGUtOhql3acPwFtMhpGKPUTmFwWQ4hlqIn6tjfo,1784
39
- edri/dataclass/injection.py,sha256=C-VzC64FNhMvnLxkGBhgc-Kma2vPIvnRUyPEpyIE-h8,3554
39
+ edri/dataclass/injection.py,sha256=64vziTFB2KJdOiW9u6ELDbw2njzY8Z8aWENAAQqo4L8,2112
40
40
  edri/dataclass/response.py,sha256=VBMmVdna1IOKC5YGBXor6AayYOoiEYb9xx_RZ3bpKnw,3867
41
41
  edri/dataclass/directive/__init__.py,sha256=nfvsh1BmxhACW7Q8gnwy7y3l3_cI1P0k2WP0jV5RJhI,608
42
42
  edri/dataclass/directive/base.py,sha256=2ghQpv1bGcNHYEMA0nyWGumIplXBzj9cPQ34aJ7uVr0,296
@@ -147,7 +147,7 @@ tests/router/test_cache.py,sha256=qzSIyumJWrZa6ZU6H2WkKZIC-kd-bhUh8qDAZEF9qzc,36
147
147
  tests/router/test_health_checker.py,sha256=StvW9FrXuFz_53GeJOeBemYBtwRfmmKyM_0sIhetHDc,5744
148
148
  tests/router/test_router.py,sha256=DzfgifAp0TnpOMt5B0o2OfZ2WYDfOOOqrDva_8QqXXI,8107
149
149
  tests/utility/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
- tests/utility/test_function.py,sha256=DviammLjqikMJ654UMasFMuiEeyuLbyBkbF_PSgwLmQ,3977
150
+ tests/utility/test_function.py,sha256=FQfjWsM-BQdIXVNNNULkBnjoZtHmiOu7wAUgsEswggk,3379
151
151
  tests/utility/test_json_encoder.py,sha256=ZblEFAsxf8VlTDqyvlr8GJNd1gwkkyH_RjMuF_Tkd8c,2618
152
152
  tests/utility/test_normalized_default_dict.py,sha256=Utd4EhN6uW6m3eBxz1hhUwRCOWqN6FLeloJ7KUh3uhk,2368
153
153
  tests/utility/test_shared_memory_pipe.py,sha256=JVzr-h8rjjlB6Uk_OnUBAlRwD2X4e74VKHBKCOE8KFM,7308
@@ -157,7 +157,7 @@ tests/utility/test_validation.py,sha256=wZcXjLrj3JheVLKnYKkkYfyC8CCpHVAw9Jn_uDnu
157
157
  tests/utility/manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
158
158
  tests/utility/manager/test_scheduler.py,sha256=sROffYvSOaWsYQxQGTy6l9Mn_qeNPRmJoXLVPKU3XNY,9153
159
159
  tests/utility/manager/test_store.py,sha256=xlo1JUsPLIhPJyQn7AXldAgWDo_O8ba2ns25TEaaGdQ,2821
160
- edri-2025.12.1rc4.dist-info/METADATA,sha256=F3trdD833w_uTf2_YtW5Yuzzk8LOj3ZvPHD3I8DwPZk,8374
161
- edri-2025.12.1rc4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
162
- edri-2025.12.1rc4.dist-info/top_level.txt,sha256=himES6JgPlx4Zt8aDrQEj2fxAd7IDD6MBOsiNZkzKHQ,11
163
- edri-2025.12.1rc4.dist-info/RECORD,,
160
+ edri-2025.12.2rc1.dist-info/METADATA,sha256=5CZ7Va_rqOYA9-RANc9xNRrmlnSeexDMWMAcZdc2ixw,8374
161
+ edri-2025.12.2rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
162
+ edri-2025.12.2rc1.dist-info/top_level.txt,sha256=himES6JgPlx4Zt8aDrQEj2fxAd7IDD6MBOsiNZkzKHQ,11
163
+ edri-2025.12.2rc1.dist-info/RECORD,,
@@ -81,22 +81,6 @@ class TestStringMethods(unittest.TestCase):
81
81
  )
82
82
  self.assertEqual(injection.classes, (StringTransformer,))
83
83
 
84
- def test_iteration(self):
85
- injection = Injection(
86
- classes=(StringTransformer,),
87
- parameters={"transform": lambda x: x[::-1]} # Reversing the string
88
- )
89
-
90
- # Test the callable functionality of iteration
91
- iter_objects = list(injection)
92
-
93
- # Check if the correct number of callables are yielded (should be 1 in this case)
94
- self.assertEqual(len(iter_objects), 1)
95
-
96
- # Create an instance using the yielded function and check the result
97
- instance = iter_objects[0]("hello")
98
- self.assertEqual(str(instance), "olleh")
99
-
100
84
  def test_repr(self):
101
85
  injection = Injection(
102
86
  classes=(StringTransformer,),