Add typing stubs for Callable, Factory, and Singleton .set_provides() attributes

This commit is contained in:
Roman Mogylatov 2021-03-06 09:02:05 -05:00
parent 41cf1bd6b4
commit ce36033faa

View File

@ -131,9 +131,10 @@ class DependenciesContainer(Object):
class Callable(Provider[T]):
def __init__(self, provides: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...
def __init__(self, provides: Optional[_Callable[..., T]] = None, *args: Injection, **kwargs: Injection) -> None: ...
@property
def provides(self) -> T: ...
def provides(self) -> Optional[T]: ...
def set_provides(self, provides: Optional[_Callable[..., T]]) -> None: ...
@property
def args(self) -> Tuple[Injection]: ...
def add_args(self, *args: Injection) -> Callable[T]: ...
@ -221,11 +222,12 @@ class Configuration(Object[Any]):
class Factory(Provider[T]):
provided_type: Optional[Type]
def __init__(self, provides: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...
def __init__(self, provides: Optional[_Callable[..., T]] = None, *args: Injection, **kwargs: Injection) -> None: ...
@property
def cls(self) -> T: ...
@property
def provides(self) -> T: ...
def set_provides(self, provides: Optional[_Callable[..., T]]) -> None: ...
@property
def args(self) -> Tuple[Injection]: ...
def add_args(self, *args: Injection) -> Factory[T]: ...
@ -270,11 +272,12 @@ class FactoryAggregate(Provider):
class BaseSingleton(Provider[T]):
provided_type = Optional[Type]
def __init__(self, provides: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...
def __init__(self, provides: Optional[_Callable[..., T]] = None, *args: Injection, **kwargs: Injection) -> None: ...
@property
def cls(self) -> T: ...
@property
def provides(self) -> T: ...
def set_provides(self, provides: Optional[_Callable[..., T]]) -> None: ...
@property
def args(self) -> Tuple[Injection]: ...
def add_args(self, *args: Injection) -> BaseSingleton[T]: ...