Add typing fix for container.override_providers()

This commit is contained in:
Roman Mogylatov 2021-08-11 21:23:18 -04:00
parent 7b19fa0964
commit c4639e555e
3 changed files with 10 additions and 1 deletions

View File

@ -12,6 +12,7 @@ Dev version
- Fix ``@containers.copy()`` decorator to respect dependencies on parent providers.
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.
- Fix typing stub for ``container.override_providers()`` to accept other types besides ``Provider``.
4.35.2
------

View File

@ -40,7 +40,7 @@ class Container:
def set_providers(self, **providers: Provider): ...
def set_provider(self, name: str, provider: Provider) -> 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_override(self) -> None: ...
def wire(self, modules: Optional[Iterable[Any]] = None, packages: Optional[Iterable[Any]] = None) -> None: ...

View File

@ -56,3 +56,11 @@ class Container6(containers.DeclarativeContainer):
container6: containers.Container = Container6()
# Test 7: to override()
class Container7(containers.DeclarativeContainer):
provider = providers.Factory(str)
container7 = Container7()
container7.override_providers(provider='new_value')