Add stub for the CallableDelegate provider

This commit is contained in:
Roman Mogylatov 2020-08-25 16:57:06 -04:00
parent 94a2575ad4
commit 027a72d3b1
2 changed files with 7 additions and 0 deletions

View File

@ -88,6 +88,10 @@ class AbstractCallable(Callable):
def override(self, provider: Callable) -> OverridingContext: ... def override(self, provider: Callable) -> OverridingContext: ...
class CallableDelegate(Delegate):
def __init__(self, callable: Callable) -> None: ...
class Factory(Provider, Generic[T]): class Factory(Provider, Generic[T]):
provided_type: Optional[Type] provided_type: Optional[Type]
def __init__(self, provides: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ... def __init__(self, provides: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...

View File

@ -47,3 +47,6 @@ animal6: Animal = provider6(1, 2, 3, b='1', c=2, e=0.0)
provider7 = providers.AbstractCallable(Animal) provider7 = providers.AbstractCallable(Animal)
provider7.override(providers.Callable(Cat)) provider7.override(providers.Callable(Cat))
animal7: Animal = provider7(1, 2, 3, b='1', c=2, e=0.0) animal7: Animal = provider7(1, 2, 3, b='1', c=2, e=0.0)
# Test 8: to check the CallableDelegate __init__
provider8 = providers.CallableDelegate(providers.Callable(lambda: None))