diff --git a/src/dependency_injector/providers.pyi b/src/dependency_injector/providers.pyi index 25865891..fca602da 100644 --- a/src/dependency_injector/providers.pyi +++ b/src/dependency_injector/providers.pyi @@ -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]: ...