python-injection 0.14.6.post1__tar.gz → 0.14.6.post2__tar.gz
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.
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/PKG-INFO +1 -1
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/invertible.py +2 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/module.py +2 -2
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/scope.py +3 -3
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/pyproject.toml +1 -1
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/.gitignore +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/README.md +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/__init__.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/__init__.pyi +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/__init__.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/__init__.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/asynchronous.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/event.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/key.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/lazy.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/type.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/descriptors.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/injectables.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/slots.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/exceptions.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/integrations/__init__.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/integrations/fastapi.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/py.typed +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/testing/__init__.py +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/testing/__init__.pyi +0 -0
- {python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/utils.py +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
+
import threading
|
3
4
|
from abc import ABC, abstractmethod
|
4
5
|
from collections import OrderedDict, deque
|
5
6
|
from collections.abc import (
|
@@ -27,7 +28,6 @@ from inspect import (
|
|
27
28
|
)
|
28
29
|
from inspect import signature as inspect_signature
|
29
30
|
from logging import Logger, getLogger
|
30
|
-
from threading import Lock
|
31
31
|
from types import MethodType
|
32
32
|
from typing import (
|
33
33
|
Any,
|
@@ -982,7 +982,7 @@ class InjectMetadata[**P, T](Caller[P, T], EventListener):
|
|
982
982
|
|
983
983
|
def __init__(self, wrapped: Callable[P, T], /, threadsafe: bool) -> None:
|
984
984
|
self.__dependencies = Dependencies.empty()
|
985
|
-
self.__lock = Lock() if threadsafe else nullcontext()
|
985
|
+
self.__lock = threading.Lock() if threadsafe else nullcontext()
|
986
986
|
self.__owner = None
|
987
987
|
self.__tasks = deque()
|
988
988
|
self.__wrapped = wrapped
|
@@ -157,18 +157,18 @@ def get_scope(name, default=...): # type: ignore[no-untyped-def]
|
|
157
157
|
def _bind_scope(name: str, scope: Scope, shared: bool) -> Iterator[None]:
|
158
158
|
if shared:
|
159
159
|
is_already_defined = bool(get_active_scopes(name))
|
160
|
-
|
160
|
+
states = __SHARED_SCOPES
|
161
161
|
|
162
162
|
else:
|
163
163
|
is_already_defined = bool(get_scope(name, default=None))
|
164
|
-
|
164
|
+
states = __CONTEXTUAL_SCOPES
|
165
165
|
|
166
166
|
if is_already_defined:
|
167
167
|
raise ScopeAlreadyDefinedError(
|
168
168
|
f"Scope `{name}` is already defined in the current context."
|
169
169
|
)
|
170
170
|
|
171
|
-
with
|
171
|
+
with states[name].bind(scope):
|
172
172
|
yield
|
173
173
|
|
174
174
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/__init__.py
RENAMED
File without changes
|
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/event.py
RENAMED
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/key.py
RENAMED
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/lazy.py
RENAMED
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/common/type.py
RENAMED
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/descriptors.py
RENAMED
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/_core/injectables.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/integrations/__init__.py
RENAMED
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/integrations/fastapi.py
RENAMED
File without changes
|
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/testing/__init__.py
RENAMED
File without changes
|
{python_injection-0.14.6.post1 → python_injection-0.14.6.post2}/injection/testing/__init__.pyi
RENAMED
File without changes
|
File without changes
|