anydi 0.60.0__tar.gz → 0.60.1__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.
- {anydi-0.60.0 → anydi-0.60.1}/PKG-INFO +1 -1
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/typer.py +8 -2
- {anydi-0.60.0 → anydi-0.60.1}/pyproject.toml +1 -1
- {anydi-0.60.0 → anydi-0.60.1}/README.md +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/__init__.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_async_lock.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_container.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_context.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_decorators.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_injector.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_module.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_provider.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_resolver.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_scanner.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/_types.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/__init__.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/django/__init__.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/fastapi.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/faststream.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/pydantic_settings.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/pytest_plugin.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/starlette/__init__.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/ext/starlette/middleware.py +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/py.typed +0 -0
- {anydi-0.60.0 → anydi-0.60.1}/anydi/testing.py +0 -0
|
@@ -15,6 +15,8 @@ from anydi import Container, Scope
|
|
|
15
15
|
|
|
16
16
|
__all__ = ["install"]
|
|
17
17
|
|
|
18
|
+
from anydi._decorators import is_provided
|
|
19
|
+
|
|
18
20
|
|
|
19
21
|
def _wrap_async_callback_no_injection(callback: Callable[..., Any]) -> Any:
|
|
20
22
|
"""Wrap async callback without injection in anyio.run()."""
|
|
@@ -60,7 +62,7 @@ def _wrap_async_callback_with_injection(
|
|
|
60
62
|
return async_wrapper
|
|
61
63
|
|
|
62
64
|
|
|
63
|
-
def _process_callback(callback: Callable[..., Any], container: Container) -> Any:
|
|
65
|
+
def _process_callback(callback: Callable[..., Any], container: Container) -> Any: # noqa: C901
|
|
64
66
|
"""Validate and wrap a callback for dependency injection."""
|
|
65
67
|
sig = inspect.signature(callback, eval_str=True)
|
|
66
68
|
injected_param_names: set[str] = set()
|
|
@@ -74,7 +76,11 @@ def _process_callback(callback: Callable[..., Any], container: Container) -> Any
|
|
|
74
76
|
)
|
|
75
77
|
if should_inject:
|
|
76
78
|
injected_param_names.add(parameter.name)
|
|
77
|
-
|
|
79
|
+
try:
|
|
80
|
+
scopes.add(container.providers[interface].scope)
|
|
81
|
+
except KeyError:
|
|
82
|
+
if inspect.isclass(interface) and is_provided(interface):
|
|
83
|
+
scopes.add(interface.__provided__["scope"])
|
|
78
84
|
else:
|
|
79
85
|
non_injected_params.add(parameter)
|
|
80
86
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|