anydi 0.26.6__py3-none-any.whl → 0.26.7a0__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.
anydi/_container.py CHANGED
@@ -429,9 +429,9 @@ class Container:
429
429
  exc_type: type[BaseException] | None,
430
430
  exc_val: BaseException | None,
431
431
  exc_tb: types.TracebackType | None,
432
- ) -> None:
432
+ ) -> bool:
433
433
  """Exit the singleton context."""
434
- self.close()
434
+ return self._singleton_context.__exit__(exc_type, exc_val, exc_tb)
435
435
 
436
436
  def start(self) -> None:
437
437
  """Start the singleton context."""
@@ -464,9 +464,9 @@ class Container:
464
464
  exc_type: type[BaseException] | None,
465
465
  exc_val: BaseException | None,
466
466
  exc_tb: types.TracebackType | None,
467
- ) -> None:
467
+ ) -> bool:
468
468
  """Exit the singleton context."""
469
- await self.aclose()
469
+ return await self._singleton_context.__aexit__(exc_type, exc_val, exc_tb)
470
470
 
471
471
  async def astart(self) -> None:
472
472
  """Start the singleton context asynchronously."""
anydi/_context.py CHANGED
@@ -243,7 +243,7 @@ class ResourceScopedContext(ScopedContext):
243
243
  exc_type: type[BaseException] | None,
244
244
  exc_val: BaseException | None,
245
245
  exc_tb: TracebackType | None,
246
- ) -> None:
246
+ ) -> bool:
247
247
  """Exit the context.
248
248
 
249
249
  Args:
@@ -251,8 +251,7 @@ class ResourceScopedContext(ScopedContext):
251
251
  exc_val: The exception instance, if any.
252
252
  exc_tb: The traceback, if any.
253
253
  """
254
- self.close()
255
- return
254
+ return self._stack.__exit__(exc_type, exc_val, exc_tb)
256
255
 
257
256
  @abc.abstractmethod
258
257
  def start(self) -> None:
@@ -262,7 +261,7 @@ class ResourceScopedContext(ScopedContext):
262
261
 
263
262
  def close(self) -> None:
264
263
  """Close the scoped context."""
265
- self._stack.close()
264
+ self._stack.__exit__(None, None, None)
266
265
 
267
266
  async def __aenter__(self) -> Self:
268
267
  """Enter the context asynchronously.
@@ -278,7 +277,7 @@ class ResourceScopedContext(ScopedContext):
278
277
  exc_type: type[BaseException] | None,
279
278
  exc_val: BaseException | None,
280
279
  exc_tb: TracebackType | None,
281
- ) -> None:
280
+ ) -> bool:
282
281
  """Exit the context asynchronously.
283
282
 
284
283
  Args:
@@ -286,8 +285,9 @@ class ResourceScopedContext(ScopedContext):
286
285
  exc_val: The exception instance, if any.
287
286
  exc_tb: The traceback, if any.
288
287
  """
289
- await self.aclose()
290
- return
288
+ return await run_async(
289
+ self.__exit__, exc_type, exc_val, exc_tb
290
+ ) or await self._async_stack.__aexit__(exc_type, exc_val, exc_tb)
291
291
 
292
292
  @abc.abstractmethod
293
293
  async def astart(self) -> None:
@@ -295,8 +295,7 @@ class ResourceScopedContext(ScopedContext):
295
295
 
296
296
  async def aclose(self) -> None:
297
297
  """Close the scoped context asynchronously."""
298
- await run_async(self._stack.close)
299
- await self._async_stack.aclose()
298
+ await self.__aexit__(None, None, None)
300
299
 
301
300
 
302
301
  @final
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: anydi
3
- Version: 0.26.6
3
+ Version: 0.26.7a0
4
4
  Summary: Dependency Injection library
5
5
  Home-page: https://github.com/antonrh/anydi
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  anydi/__init__.py,sha256=aeaBp5vq09sG-e9sqqs9qpUtUIDNfOdFPrlAfE5Ku9E,584
2
- anydi/_container.py,sha256=OjzwZPiQuf9ouyhmIqlNht99pHa77hjZ0sM_n_GovW0,28947
3
- anydi/_context.py,sha256=AVml53KyrQL4yyoJZkU2pbNzQwtg-1Jyt7m6R_0l6_8,11740
2
+ anydi/_container.py,sha256=-vpiYl2Tx2QK9wl74DiF5qLFRudJ3e78TqEyuyOrthE,29055
3
+ anydi/_context.py,sha256=qqaPVv-nnpHQL5R9wFL6-709eyAt9ZnzZov79NPEHIc,11865
4
4
  anydi/_logger.py,sha256=UpubJUnW83kffFxkhUlObm2DmZX1Pjqoz9YFKS-JOPg,52
5
5
  anydi/_module.py,sha256=E1TfLud_Af-MPB83PxIzHVA1jlDW2FGaRP_il1a6y3Y,3675
6
6
  anydi/_scanner.py,sha256=cyEk-K2Q8ssZStq8GrxMeEcCuAZMw-RXrjlgWEevKCs,6667
@@ -21,8 +21,8 @@ anydi/ext/pytest_plugin.py,sha256=3OWphc4nEzla46_8KR7LXtwGns5eol_YlUWfTf4Cr2Q,39
21
21
  anydi/ext/starlette/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  anydi/ext/starlette/middleware.py,sha256=Ni0BQaPjs_Ha6zcLZYYJ3-XkslTCnL9aCSa06rnRDMI,1139
23
23
  anydi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- anydi-0.26.6.dist-info/LICENSE,sha256=V6rU8a8fv6o2jQ-7ODHs0XfDFimot8Q6Km6CylRIDTo,1069
25
- anydi-0.26.6.dist-info/METADATA,sha256=YMB7LVYZSxh_iEu9at9KFOkx9IzqFjZDj6Qjka_33oA,5110
26
- anydi-0.26.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
27
- anydi-0.26.6.dist-info/entry_points.txt,sha256=GmQblwzxFg42zva1HyBYJJ7TvrTIcSAGBHmyi3bvsi4,42
28
- anydi-0.26.6.dist-info/RECORD,,
24
+ anydi-0.26.7a0.dist-info/LICENSE,sha256=V6rU8a8fv6o2jQ-7ODHs0XfDFimot8Q6Km6CylRIDTo,1069
25
+ anydi-0.26.7a0.dist-info/METADATA,sha256=YSu_Cri5zXAYGI1DvraJ_iyS9ySq8UXmbID5peTn9jI,5112
26
+ anydi-0.26.7a0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
27
+ anydi-0.26.7a0.dist-info/entry_points.txt,sha256=GmQblwzxFg42zva1HyBYJJ7TvrTIcSAGBHmyi3bvsi4,42
28
+ anydi-0.26.7a0.dist-info/RECORD,,