mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-10-11 06:17:02 +03:00
Add stub for the CallableDelegate provider
This commit is contained in:
parent
94a2575ad4
commit
027a72d3b1
|
@ -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: ...
|
||||||
|
|
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user