mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 01:26:51 +03:00
Add typing fix for container.override_providers()
This commit is contained in:
parent
7b19fa0964
commit
c4639e555e
|
@ -12,6 +12,7 @@ Dev version
|
||||||
- Fix ``@containers.copy()`` decorator to respect dependencies on parent providers.
|
- Fix ``@containers.copy()`` decorator to respect dependencies on parent providers.
|
||||||
See issue `#477 <https://github.com/ets-labs/python-dependency-injector/issues/477>`_.
|
See issue `#477 <https://github.com/ets-labs/python-dependency-injector/issues/477>`_.
|
||||||
Thanks to `Andrey Torsunov @gtors <https://github.com/gtors>`_ for reporting the issue.
|
Thanks to `Andrey Torsunov @gtors <https://github.com/gtors>`_ for reporting the issue.
|
||||||
|
- Fix typing stub for ``container.override_providers()`` to accept other types besides ``Provider``.
|
||||||
|
|
||||||
4.35.2
|
4.35.2
|
||||||
------
|
------
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Container:
|
||||||
def set_providers(self, **providers: Provider): ...
|
def set_providers(self, **providers: Provider): ...
|
||||||
def set_provider(self, name: str, provider: Provider) -> None: ...
|
def set_provider(self, name: str, provider: Provider) -> None: ...
|
||||||
def override(self, overriding: C_Base) -> None: ...
|
def override(self, overriding: C_Base) -> None: ...
|
||||||
def override_providers(self, **overriding_providers: Provider) -> None: ...
|
def override_providers(self, **overriding_providers: Union[Provider, Any]) -> None: ...
|
||||||
def reset_last_overriding(self) -> None: ...
|
def reset_last_overriding(self) -> None: ...
|
||||||
def reset_override(self) -> None: ...
|
def reset_override(self) -> None: ...
|
||||||
def wire(self, modules: Optional[Iterable[Any]] = None, packages: Optional[Iterable[Any]] = None) -> None: ...
|
def wire(self, modules: Optional[Iterable[Any]] = None, packages: Optional[Iterable[Any]] = None) -> None: ...
|
||||||
|
|
|
@ -56,3 +56,11 @@ class Container6(containers.DeclarativeContainer):
|
||||||
|
|
||||||
|
|
||||||
container6: containers.Container = Container6()
|
container6: containers.Container = Container6()
|
||||||
|
|
||||||
|
|
||||||
|
# Test 7: to override()
|
||||||
|
class Container7(containers.DeclarativeContainer):
|
||||||
|
provider = providers.Factory(str)
|
||||||
|
|
||||||
|
container7 = Container7()
|
||||||
|
container7.override_providers(provider='new_value')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user