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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anydi
3
- Version: 0.60.0
3
+ Version: 0.60.1
4
4
  Summary: Dependency Injection library
5
5
  Keywords: dependency injection,dependencies,di,async,asyncio,application
6
6
  Author: Anton Ruhlov
@@ -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
- scopes.add(container.providers[interface].scope)
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
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "anydi"
3
- version = "0.60.0"
3
+ version = "0.60.1"
4
4
  description = "Dependency Injection library"
5
5
  authors = [{ name = "Anton Ruhlov", email = "antonruhlov@gmail.com" }]
6
6
  requires-python = ">=3.10.0, <3.15"
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