python-injection 0.18.9__py3-none-any.whl → 0.18.10__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.
- injection/_core/scope.py +9 -7
- {python_injection-0.18.9.dist-info → python_injection-0.18.10.dist-info}/METADATA +1 -1
- {python_injection-0.18.9.dist-info → python_injection-0.18.10.dist-info}/RECORD +5 -5
- {python_injection-0.18.9.dist-info → python_injection-0.18.10.dist-info}/WHEEL +0 -0
- {python_injection-0.18.9.dist-info → python_injection-0.18.10.dist-info}/licenses/LICENSE +0 -0
injection/_core/scope.py
CHANGED
@@ -223,11 +223,10 @@ def _bind_scope(
|
|
223
223
|
)
|
224
224
|
|
225
225
|
stack = ExitStack()
|
226
|
-
|
227
|
-
stack.enter_context(binder)
|
226
|
+
stack.enter_context(states[name].bind(scope))
|
228
227
|
|
229
228
|
try:
|
230
|
-
yield _UserScope(scope)
|
229
|
+
yield _UserScope(scope, lock)
|
231
230
|
|
232
231
|
finally:
|
233
232
|
with lock:
|
@@ -325,6 +324,7 @@ class ScopeFacade(Protocol):
|
|
325
324
|
@dataclass(repr=False, frozen=True, slots=True)
|
326
325
|
class _UserScope(ScopeFacade):
|
327
326
|
scope: Scope
|
327
|
+
lock: ContextManager[Any]
|
328
328
|
|
329
329
|
def set_slot[T](self, key: SlotKey[T], value: T) -> Self:
|
330
330
|
return self.slot_map({key: value})
|
@@ -332,9 +332,11 @@ class _UserScope(ScopeFacade):
|
|
332
332
|
def slot_map(self, mapping: Mapping[SlotKey[Any], Any], /) -> Self:
|
333
333
|
cache = self.scope.cache
|
334
334
|
|
335
|
-
|
336
|
-
|
337
|
-
|
335
|
+
with self.lock:
|
336
|
+
for slot_key in mapping:
|
337
|
+
if slot_key in cache:
|
338
|
+
raise InjectionError("Slot already set.")
|
339
|
+
|
340
|
+
cache.update(mapping)
|
338
341
|
|
339
|
-
cache.update(mapping)
|
340
342
|
return self
|
@@ -8,7 +8,7 @@ injection/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
injection/_core/descriptors.py,sha256=jH0pyIlPurMmU4yXr-HKS_7BJ-9d0XUvEx4pQre3QeI,704
|
9
9
|
injection/_core/injectables.py,sha256=Rg1nxDkbcpeX4ELohrNVMguPhN36SNQuD0JKfyfL6bI,6192
|
10
10
|
injection/_core/module.py,sha256=4WqrDti98A5CrIWaHlld1GYYm4K-8XkKltchJoyXUTU,32016
|
11
|
-
injection/_core/scope.py,sha256=
|
11
|
+
injection/_core/scope.py,sha256=SEXO1CBJc4EzITi6oMotnNqIrRpLzabjNaBPD18_KHA,8784
|
12
12
|
injection/_core/slots.py,sha256=g9TG6CbqRzCsjg01iPyfRtTTUCJnnJOwcj9mJabH0dc,37
|
13
13
|
injection/_core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
injection/_core/common/asynchronous.py,sha256=QeS2Lc4gEBFvTA_snOWfme5mTL4BFZWqZ8EzJwOdVos,1816
|
@@ -22,7 +22,7 @@ injection/ext/fastapi.py,sha256=layUUer5IWiZX6Mmx1_RCYDLNCtEHtpya5ZL6TTBOkY,968
|
|
22
22
|
injection/ext/fastapi.pyi,sha256=8OZEUjHFB9n7QXv_dtXdDuXW-r2huQEFsJ03gJOOvwQ,125
|
23
23
|
injection/testing/__init__.py,sha256=bJ7WXBXrw4rHc91AFVFnOwFLWOlpvX9Oh2SnRQ_NESo,919
|
24
24
|
injection/testing/__init__.pyi,sha256=raGsGlxwbz3jkzJwA_5oCIE1emWINjT2UuwzbnqRb-0,577
|
25
|
-
python_injection-0.18.
|
26
|
-
python_injection-0.18.
|
27
|
-
python_injection-0.18.
|
28
|
-
python_injection-0.18.
|
25
|
+
python_injection-0.18.10.dist-info/METADATA,sha256=65dTrGn29gCNAUxlwj-Kq10XuQ2xtVLzsv9xdrPaVYQ,3398
|
26
|
+
python_injection-0.18.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
27
|
+
python_injection-0.18.10.dist-info/licenses/LICENSE,sha256=oC77BOa9kaaQni5rW-Z-ytz3E5h4EVg248BHg9UFgyg,1063
|
28
|
+
python_injection-0.18.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|