anydi 0.37.2__py3-none-any.whl → 0.37.3__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 +8 -1
- {anydi-0.37.2.dist-info → anydi-0.37.3.dist-info}/METADATA +1 -1
- {anydi-0.37.2.dist-info → anydi-0.37.3.dist-info}/RECORD +6 -6
- {anydi-0.37.2.dist-info → anydi-0.37.3.dist-info}/LICENSE +0 -0
- {anydi-0.37.2.dist-info → anydi-0.37.3.dist-info}/WHEEL +0 -0
- {anydi-0.37.2.dist-info → anydi-0.37.3.dist-info}/entry_points.txt +0 -0
anydi/_container.py
CHANGED
|
@@ -86,11 +86,13 @@ class Container:
|
|
|
86
86
|
modules: Sequence[Module | type[Module] | Callable[[Container], None] | str]
|
|
87
87
|
| None = None,
|
|
88
88
|
strict: bool = False,
|
|
89
|
+
default_scope: Scope = "transient",
|
|
89
90
|
testing: bool = False,
|
|
90
91
|
logger: logging.Logger | None = None,
|
|
91
92
|
) -> None:
|
|
92
93
|
self._providers: dict[type[Any], Provider] = {}
|
|
93
94
|
self._strict = strict
|
|
95
|
+
self._default_scope = default_scope
|
|
94
96
|
self._testing = testing
|
|
95
97
|
self._logger = logger or logging.getLogger(__name__)
|
|
96
98
|
self._resources: dict[str, list[type[Any]]] = defaultdict(list)
|
|
@@ -121,6 +123,11 @@ class Container:
|
|
|
121
123
|
"""Check if strict mode is enabled."""
|
|
122
124
|
return self._strict
|
|
123
125
|
|
|
126
|
+
@property
|
|
127
|
+
def default_scope(self) -> Scope:
|
|
128
|
+
"""Get the default scope."""
|
|
129
|
+
return self._default_scope
|
|
130
|
+
|
|
124
131
|
@property
|
|
125
132
|
def testing(self) -> bool:
|
|
126
133
|
"""Check if testing mode is enabled."""
|
|
@@ -221,7 +228,7 @@ class Container:
|
|
|
221
228
|
# Try to detect scope
|
|
222
229
|
if scope is None:
|
|
223
230
|
scope = self._detect_scope(interface, **defaults)
|
|
224
|
-
scope = scope or
|
|
231
|
+
scope = scope or self.default_scope
|
|
225
232
|
provider = Provider(call=interface, scope=scope, interface=interface)
|
|
226
233
|
return self._register_provider(provider, False, **defaults)
|
|
227
234
|
raise
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
anydi/__init__.py,sha256=OfRg2EfXD65pHTGQKhfkABMwUhw5LvsuTQV_Tv4V4wk,501
|
|
2
|
-
anydi/_container.py,sha256=
|
|
2
|
+
anydi/_container.py,sha256=yH1DsSQFkbfxGaDFs47nr-iXLE_Wwgv6QMTGWrRb8cE,38524
|
|
3
3
|
anydi/_context.py,sha256=7LV_SL4QWkJeiG7_4D9PZ5lmU-MPzhofxC95zCgY9Gc,2651
|
|
4
4
|
anydi/_provider.py,sha256=1IyxHO83NHjsPDHLDIZtW1pJ7i8VpWD3EM4T6duw9zA,7661
|
|
5
5
|
anydi/_types.py,sha256=fdO4xNXtGMxVArmlfDkFYbyR895ixkBTW6V8lMceN7Q,1562
|
|
@@ -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.37.
|
|
26
|
-
anydi-0.37.
|
|
27
|
-
anydi-0.37.
|
|
28
|
-
anydi-0.37.
|
|
29
|
-
anydi-0.37.
|
|
25
|
+
anydi-0.37.3.dist-info/LICENSE,sha256=V6rU8a8fv6o2jQ-7ODHs0XfDFimot8Q6Km6CylRIDTo,1069
|
|
26
|
+
anydi-0.37.3.dist-info/METADATA,sha256=8QjGkBnTAht-DDMytibrHIM_kSnm3bQSUiDt8IUW2pc,5103
|
|
27
|
+
anydi-0.37.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
28
|
+
anydi-0.37.3.dist-info/entry_points.txt,sha256=GmQblwzxFg42zva1HyBYJJ7TvrTIcSAGBHmyi3bvsi4,42
|
|
29
|
+
anydi-0.37.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|