anydi 0.36.1a4__py3-none-any.whl → 0.36.1a5__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 +3 -14
- anydi/_utils.py +0 -10
- {anydi-0.36.1a4.dist-info → anydi-0.36.1a5.dist-info}/METADATA +1 -1
- {anydi-0.36.1a4.dist-info → anydi-0.36.1a5.dist-info}/RECORD +7 -7
- {anydi-0.36.1a4.dist-info → anydi-0.36.1a5.dist-info}/LICENSE +0 -0
- {anydi-0.36.1a4.dist-info → anydi-0.36.1a5.dist-info}/WHEEL +0 -0
- {anydi-0.36.1a4.dist-info → anydi-0.36.1a5.dist-info}/entry_points.txt +0 -0
anydi/_container.py
CHANGED
|
@@ -36,9 +36,7 @@ from ._utils import (
|
|
|
36
36
|
get_full_qualname,
|
|
37
37
|
get_typed_parameters,
|
|
38
38
|
import_string,
|
|
39
|
-
is_async_context_manager,
|
|
40
39
|
is_builtin_type,
|
|
41
|
-
is_context_manager,
|
|
42
40
|
run_async,
|
|
43
41
|
)
|
|
44
42
|
|
|
@@ -555,10 +553,7 @@ class Container:
|
|
|
555
553
|
cm = contextlib.contextmanager(provider.call)(**provider_kwargs)
|
|
556
554
|
return context.enter(cm)
|
|
557
555
|
|
|
558
|
-
|
|
559
|
-
if context is not None and is_context_manager(instance):
|
|
560
|
-
context.enter(instance)
|
|
561
|
-
return instance
|
|
556
|
+
return provider.call(**provider_kwargs)
|
|
562
557
|
|
|
563
558
|
async def _acreate_instance(
|
|
564
559
|
self, provider: Provider, context: InstanceContext | None, /, **defaults: Any
|
|
@@ -569,10 +564,7 @@ class Container:
|
|
|
569
564
|
)
|
|
570
565
|
|
|
571
566
|
if provider.is_coroutine:
|
|
572
|
-
|
|
573
|
-
if context is not None and is_async_context_manager(instance):
|
|
574
|
-
await context.aenter(instance)
|
|
575
|
-
return instance
|
|
567
|
+
return await provider.call(**provider_kwargs)
|
|
576
568
|
|
|
577
569
|
if provider.is_async_generator:
|
|
578
570
|
if context is None:
|
|
@@ -592,10 +584,7 @@ class Container:
|
|
|
592
584
|
|
|
593
585
|
return await run_async(_create)
|
|
594
586
|
|
|
595
|
-
|
|
596
|
-
if context is not None and is_async_context_manager(instance):
|
|
597
|
-
await context.aenter(instance)
|
|
598
|
-
return instance
|
|
587
|
+
return await run_async(provider.call, **provider_kwargs)
|
|
599
588
|
|
|
600
589
|
def _get_provided_kwargs(
|
|
601
590
|
self, provider: Provider, context: InstanceContext | None, /, **defaults: Any
|
anydi/_utils.py
CHANGED
|
@@ -44,16 +44,6 @@ def is_builtin_type(tp: type[Any]) -> bool:
|
|
|
44
44
|
return tp.__module__ == builtins.__name__
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
def is_context_manager(obj: Any) -> bool:
|
|
48
|
-
"""Check if the given object is a context manager."""
|
|
49
|
-
return hasattr(obj, "__enter__") and hasattr(obj, "__exit__")
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def is_async_context_manager(obj: Any) -> bool:
|
|
53
|
-
"""Check if the given object is an async context manager."""
|
|
54
|
-
return hasattr(obj, "__aenter__") and hasattr(obj, "__aexit__")
|
|
55
|
-
|
|
56
|
-
|
|
57
47
|
def get_typed_annotation(
|
|
58
48
|
annotation: Any, globalns: dict[str, Any], module: Any = None
|
|
59
49
|
) -> Any:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
anydi/__init__.py,sha256=OfRg2EfXD65pHTGQKhfkABMwUhw5LvsuTQV_Tv4V4wk,501
|
|
2
|
-
anydi/_container.py,sha256=
|
|
2
|
+
anydi/_container.py,sha256=7Qwreyqnc95M0mgDus6vQmyuIF5qLFTMaBoA7GoWELg,37772
|
|
3
3
|
anydi/_context.py,sha256=7LV_SL4QWkJeiG7_4D9PZ5lmU-MPzhofxC95zCgY9Gc,2651
|
|
4
4
|
anydi/_provider.py,sha256=W42y8wbsnWbb9B9gI-pnEa-lsz68nK0VIm55CJW3pWg,7457
|
|
5
5
|
anydi/_types.py,sha256=Vttj9GTp9g0KKpK-uqolLfVZJPIM7f7_YL8bPlablcQ,1539
|
|
6
|
-
anydi/_utils.py,sha256=
|
|
6
|
+
anydi/_utils.py,sha256=gU5ccCC2JZpKOY84ZCJ3PHyaEGhTW82PkGAhS6_R_qI,4027
|
|
7
7
|
anydi/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
anydi/ext/_utils.py,sha256=U6sRqWzccWUu7eMhbXX1NrwcaxitQF9cO1KxnKF37gw,2566
|
|
9
9
|
anydi/ext/django/__init__.py,sha256=QI1IABCVgSDTUoh7M9WMECKXwB3xvh04HfQ9TOWw1Mk,223
|
|
@@ -22,8 +22,8 @@ anydi/ext/pytest_plugin.py,sha256=ShGhiZnP1KyMHhnc9Ci1RKAuHVhw628OTS2P2BLEOfc,50
|
|
|
22
22
|
anydi/ext/starlette/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
anydi/ext/starlette/middleware.py,sha256=9CQtGg5ZzUz2gFSzJr8U4BWzwNjK8XMctm3n52M77Z0,792
|
|
24
24
|
anydi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
-
anydi-0.36.
|
|
26
|
-
anydi-0.36.
|
|
27
|
-
anydi-0.36.
|
|
28
|
-
anydi-0.36.
|
|
29
|
-
anydi-0.36.
|
|
25
|
+
anydi-0.36.1a5.dist-info/LICENSE,sha256=V6rU8a8fv6o2jQ-7ODHs0XfDFimot8Q6Km6CylRIDTo,1069
|
|
26
|
+
anydi-0.36.1a5.dist-info/METADATA,sha256=pmhLHtLYS6Hi90rx0etN5ViIkIJYGMeOopTfyKPCHhY,5066
|
|
27
|
+
anydi-0.36.1a5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
28
|
+
anydi-0.36.1a5.dist-info/entry_points.txt,sha256=GmQblwzxFg42zva1HyBYJJ7TvrTIcSAGBHmyi3bvsi4,42
|
|
29
|
+
anydi-0.36.1a5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|