Add Delegate stub

This commit is contained in:
Roman Mogylatov 2020-08-25 16:31:43 -04:00
parent 8f7b466de9
commit 821f0be3b7
2 changed files with 11 additions and 0 deletions

View File

@ -37,6 +37,11 @@ class Object(Provider, Generic[T]):
def provided(self) -> ProvidedInstance: ...
class Delegate(Provider):
def __init__(self, provides: Provider) -> None: ...
def __call__(self, *args: Injection, **kwargs: Injection) -> Provider: ...
class Callable(Provider, Generic[T]):
def __init__(self, provides: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...
def __call__(self, *args: Injection, **kwargs: Injection) -> T: ...

6
tests/typing/delegate.py Normal file
View File

@ -0,0 +1,6 @@
from dependency_injector import providers
# Test 1: to check the return type
provider1 = providers.Delegate(providers.Provider())
var1: providers.Provider = provider1()