modern-di 0.7.1__tar.gz → 0.7.2__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.

Potentially problematic release.


This version of modern-di might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: modern-di
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: Dependency Injection framework with IOC-container and scopes
5
5
  Project-URL: repository, https://github.com/modern-python/modern-di
6
6
  Project-URL: docs, https://modern-di.readthedocs.io
@@ -9,16 +9,21 @@ T_co = typing.TypeVar("T_co", covariant=True)
9
9
  P = typing.ParamSpec("P")
10
10
 
11
11
 
12
- class InjectedFactory(typing.Generic[T_co]):
13
- __slots__ = ("_factory_provider",)
12
+ class InjectedFactory(AbstractProvider[T_co]):
13
+ __slots__ = [*AbstractProvider.BASE_SLOTS, "_factory_provider"]
14
14
 
15
15
  def __init__(self, factory_provider: AbstractProvider[T_co]) -> None:
16
+ super().__init__(factory_provider.scope)
16
17
  self._factory_provider = factory_provider
17
18
 
18
- async def async_resolve(self, container: Container) -> typing.Callable[[], T_co]:
19
+ async def async_resolve(self, container: Container) -> typing.Callable[[], T_co]: # type: ignore[override]
19
20
  await self._factory_provider.async_resolve(container)
20
21
  return functools.partial(self._factory_provider.sync_resolve, container)
21
22
 
22
- def sync_resolve(self, container: Container) -> typing.Callable[[], T_co]:
23
+ def sync_resolve(self, container: Container) -> typing.Callable[[], T_co]: # type: ignore[override]
23
24
  self._factory_provider.sync_resolve(container)
24
25
  return functools.partial(self._factory_provider.sync_resolve, container)
26
+
27
+ @property
28
+ def cast(self) -> typing.Callable[[], T_co]: # type: ignore[override]
29
+ return typing.cast(typing.Callable[[], T_co], self)
File without changes
File without changes
File without changes
File without changes
File without changes