mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-08 22:33:15 +03:00
Add Delegate stub
This commit is contained in:
parent
8f7b466de9
commit
821f0be3b7
|
@ -37,6 +37,11 @@ class Object(Provider, Generic[T]):
|
||||||
def provided(self) -> ProvidedInstance: ...
|
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]):
|
class Callable(Provider, Generic[T]):
|
||||||
def __init__(self, provides: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...
|
def __init__(self, provides: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...
|
||||||
def __call__(self, *args: Injection, **kwargs: Injection) -> T: ...
|
def __call__(self, *args: Injection, **kwargs: Injection) -> T: ...
|
||||||
|
|
6
tests/typing/delegate.py
Normal file
6
tests/typing/delegate.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user