mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-10-11 14:26:37 +03:00
Add stub for the Container provider
This commit is contained in:
parent
5100f13bff
commit
ce412980d2
|
@ -261,6 +261,13 @@ class List(Provider):
|
||||||
def clear_args(self) -> List: ...
|
def clear_args(self) -> List: ...
|
||||||
|
|
||||||
|
|
||||||
|
class Container(Provider):
|
||||||
|
|
||||||
|
def __init__(self, container_cls: Type[T], container: Optional[T] = None, **overriding_providers: Provider) -> None: ...
|
||||||
|
def __call__(self, *args: Injection, **kwargs: Injection) -> T: ...
|
||||||
|
def __getattr__(self, name: str) -> Provider: ...
|
||||||
|
|
||||||
|
|
||||||
class ProvidedInstanceFluentInterface:
|
class ProvidedInstanceFluentInterface:
|
||||||
def __getattr__(self, item: str) -> AttributeGetter: ...
|
def __getattr__(self, item: str) -> AttributeGetter: ...
|
||||||
def __getitem__(self, item: str) -> ItemGetter: ...
|
def __getitem__(self, item: str) -> ItemGetter: ...
|
||||||
|
|
14
tests/typing/container.py
Normal file
14
tests/typing/container.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from dependency_injector import providers
|
||||||
|
|
||||||
|
|
||||||
|
class Container:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
# Test 1: to check the return type
|
||||||
|
provider1 = providers.Container(Container)
|
||||||
|
var1: Container = provider1()
|
||||||
|
|
||||||
|
# Test 2: to check the getattr
|
||||||
|
provider2 = providers.Container(Container)
|
||||||
|
attr: providers.Provider = provider2.attr
|
Loading…
Reference in New Issue
Block a user