mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-11-24 11:55:47 +03:00
Improve type annotations in providers
This commit is contained in:
parent
009a86de2c
commit
d72d07caf7
|
|
@ -89,7 +89,7 @@ class Object(Provider[T]):
|
|||
def __init__(self, provides: Optional[T] = None) -> None: ...
|
||||
@property
|
||||
def provides(self) -> Optional[T]: ...
|
||||
def set_provides(self, provides: Optional[T]) -> Object: ...
|
||||
def set_provides(self, provides: Optional[T]) -> _Self: ...
|
||||
|
||||
class Self(Provider[T]):
|
||||
def __init__(self, container: Optional[T] = None) -> None: ...
|
||||
|
|
@ -102,7 +102,7 @@ class Delegate(Provider[Provider]):
|
|||
def __init__(self, provides: Optional[Provider] = None) -> None: ...
|
||||
@property
|
||||
def provides(self) -> Optional[Provider]: ...
|
||||
def set_provides(self, provides: Optional[Provider]) -> Delegate: ...
|
||||
def set_provides(self, provides: Optional[Provider]) -> _Self: ...
|
||||
|
||||
class Aggregate(Provider[T]):
|
||||
def __init__(
|
||||
|
|
@ -128,7 +128,7 @@ class Aggregate(Provider[T]):
|
|||
self,
|
||||
provider_dict: Optional[Mapping[Any, Provider[T]]] = None,
|
||||
**provider_kwargs: Provider[T],
|
||||
) -> Aggregate[T]: ...
|
||||
) -> _Self: ...
|
||||
|
||||
class Dependency(Provider[T]):
|
||||
def __init__(
|
||||
|
|
@ -139,10 +139,10 @@ class Dependency(Provider[T]):
|
|||
def __getattr__(self, name: str) -> Any: ...
|
||||
@property
|
||||
def instance_of(self) -> Type[T]: ...
|
||||
def set_instance_of(self, instance_of: Type[T]) -> Dependency[T]: ...
|
||||
def set_instance_of(self, instance_of: Type[T]) -> _Self: ...
|
||||
@property
|
||||
def default(self) -> Provider[T]: ...
|
||||
def set_default(self, default: Optional[Union[Provider, Any]]) -> Dependency[T]: ...
|
||||
def set_default(self, default: Optional[Union[Provider, Any]]) -> _Self: ...
|
||||
@property
|
||||
def is_defined(self) -> bool: ...
|
||||
def provided_by(self, provider: Provider) -> OverridingContext[P]: ...
|
||||
|
|
@ -166,28 +166,28 @@ class DependenciesContainer(Object):
|
|||
def parent_name(self) -> Optional[str]: ...
|
||||
def assign_parent(self, parent: ProviderParent) -> None: ...
|
||||
|
||||
class Callable(Provider[T]):
|
||||
class Callable(Provider[T_Any]):
|
||||
def __init__(
|
||||
self,
|
||||
provides: Optional[Union[_Callable[..., T], str]] = None,
|
||||
provides: Optional[Union[_Callable[..., T_Any], str]] = None,
|
||||
*args: Injection,
|
||||
**kwargs: Injection,
|
||||
) -> None: ...
|
||||
@property
|
||||
def provides(self) -> Optional[_Callable[..., T]]: ...
|
||||
def provides(self) -> Optional[_Callable[..., T_Any]]: ...
|
||||
def set_provides(
|
||||
self, provides: Optional[Union[_Callable[..., T], str]]
|
||||
) -> Callable[T]: ...
|
||||
self, provides: Optional[Union[_Callable[..., T_Any], str]]
|
||||
) -> _Self: ...
|
||||
@property
|
||||
def args(self) -> Tuple[Injection]: ...
|
||||
def add_args(self, *args: Injection) -> Callable[T]: ...
|
||||
def set_args(self, *args: Injection) -> Callable[T]: ...
|
||||
def clear_args(self) -> Callable[T]: ...
|
||||
def add_args(self, *args: Injection) -> _Self: ...
|
||||
def set_args(self, *args: Injection) -> _Self: ...
|
||||
def clear_args(self) -> _Self: ...
|
||||
@property
|
||||
def kwargs(self) -> _Dict[str, Injection]: ...
|
||||
def add_kwargs(self, **kwargs: Injection) -> Callable[T]: ...
|
||||
def set_kwargs(self, **kwargs: Injection) -> Callable[T]: ...
|
||||
def clear_kwargs(self) -> Callable[T]: ...
|
||||
def add_kwargs(self, **kwargs: Injection) -> _Self: ...
|
||||
def set_kwargs(self, **kwargs: Injection) -> _Self: ...
|
||||
def clear_kwargs(self) -> _Self: ...
|
||||
|
||||
class DelegatedCallable(Callable[T]): ...
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ class CoroutineDelegate(Delegate):
|
|||
class ConfigurationOption(Provider[Any]):
|
||||
UNDEFINED: object
|
||||
def __init__(self, name: Tuple[str], root: Configuration) -> None: ...
|
||||
def __enter__(self) -> ConfigurationOption: ...
|
||||
def __enter__(self) -> _Self: ...
|
||||
def __exit__(self, *exc_info: Any) -> None: ...
|
||||
def __getattr__(self, item: str) -> ConfigurationOption: ...
|
||||
def __getitem__(self, item: Union[str, Provider]) -> ConfigurationOption: ...
|
||||
|
|
@ -274,30 +274,26 @@ class Configuration(Object[Any]):
|
|||
json_files: Optional[_Iterable[Union[Path, str]]] = None,
|
||||
pydantic_settings: Optional[_Iterable[PydanticSettings]] = None,
|
||||
) -> None: ...
|
||||
def __enter__(self) -> Configuration: ...
|
||||
def __enter__(self) -> _Self: ...
|
||||
def __exit__(self, *exc_info: Any) -> None: ...
|
||||
def __getattr__(self, item: str) -> ConfigurationOption: ...
|
||||
def __getitem__(self, item: Union[str, Provider]) -> ConfigurationOption: ...
|
||||
def get_name(self) -> str: ...
|
||||
def set_name(self, name: str) -> Configuration: ...
|
||||
def set_name(self, name: str) -> _Self: ...
|
||||
def get_default(self) -> _Dict[Any, Any]: ...
|
||||
def set_default(self, default: _Dict[Any, Any]): ...
|
||||
def set_default(self, default: _Dict[Any, Any]) -> _Self: ...
|
||||
def get_strict(self) -> bool: ...
|
||||
def set_strict(self, strict: bool) -> Configuration: ...
|
||||
def set_strict(self, strict: bool) -> _Self: ...
|
||||
def get_children(self) -> _Dict[str, ConfigurationOption]: ...
|
||||
def set_children(
|
||||
self, children: _Dict[str, ConfigurationOption]
|
||||
) -> Configuration: ...
|
||||
def set_children(self, children: _Dict[str, ConfigurationOption]) -> _Self: ...
|
||||
def get_ini_files(self) -> _List[Union[Path, str]]: ...
|
||||
def set_ini_files(self, files: _Iterable[Union[Path, str]]) -> Configuration: ...
|
||||
def set_ini_files(self, files: _Iterable[Union[Path, str]]) -> _Self: ...
|
||||
def get_yaml_files(self) -> _List[Union[Path, str]]: ...
|
||||
def set_yaml_files(self, files: _Iterable[Union[Path, str]]) -> Configuration: ...
|
||||
def set_yaml_files(self, files: _Iterable[Union[Path, str]]) -> _Self: ...
|
||||
def get_json_files(self) -> _List[Union[Path, str]]: ...
|
||||
def set_json_files(self, files: _Iterable[Union[Path, str]]) -> Configuration: ...
|
||||
def set_json_files(self, files: _Iterable[Union[Path, str]]) -> _Self: ...
|
||||
def get_pydantic_settings(self) -> _List[PydanticSettings]: ...
|
||||
def set_pydantic_settings(
|
||||
self, settings: _Iterable[PydanticSettings]
|
||||
) -> Configuration: ...
|
||||
def set_pydantic_settings(self, settings: _Iterable[PydanticSettings]) -> _Self: ...
|
||||
def load(self, required: bool = False, envs_required: bool = False) -> None: ...
|
||||
def get(self, selector: str) -> Any: ...
|
||||
def set(self, selector: str, value: Any) -> OverridingContext[P]: ...
|
||||
|
|
@ -349,22 +345,22 @@ class Factory(Provider[T]):
|
|||
def provides(self) -> Optional[_Callable[..., T]]: ...
|
||||
def set_provides(
|
||||
self, provides: Optional[Union[_Callable[..., T], str]]
|
||||
) -> Factory[T]: ...
|
||||
) -> _Self: ...
|
||||
@property
|
||||
def args(self) -> Tuple[Injection]: ...
|
||||
def add_args(self, *args: Injection) -> Factory[T]: ...
|
||||
def set_args(self, *args: Injection) -> Factory[T]: ...
|
||||
def clear_args(self) -> Factory[T]: ...
|
||||
def add_args(self, *args: Injection) -> _Self: ...
|
||||
def set_args(self, *args: Injection) -> _Self: ...
|
||||
def clear_args(self) -> _Self: ...
|
||||
@property
|
||||
def kwargs(self) -> _Dict[str, Injection]: ...
|
||||
def add_kwargs(self, **kwargs: Injection) -> Factory[T]: ...
|
||||
def set_kwargs(self, **kwargs: Injection) -> Factory[T]: ...
|
||||
def clear_kwargs(self) -> Factory[T]: ...
|
||||
def add_kwargs(self, **kwargs: Injection) -> _Self: ...
|
||||
def set_kwargs(self, **kwargs: Injection) -> _Self: ...
|
||||
def clear_kwargs(self) -> _Self: ...
|
||||
@property
|
||||
def attributes(self) -> _Dict[Any, Injection]: ...
|
||||
def add_attributes(self, **kwargs: Injection) -> Factory[T]: ...
|
||||
def set_attributes(self, **kwargs: Injection) -> Factory[T]: ...
|
||||
def clear_attributes(self) -> Factory[T]: ...
|
||||
def attributes(self) -> _Dict[str, Injection]: ...
|
||||
def add_attributes(self, **kwargs: Injection) -> _Self: ...
|
||||
def set_attributes(self, **kwargs: Injection) -> _Self: ...
|
||||
def clear_attributes(self) -> _Self: ...
|
||||
|
||||
class DelegatedFactory(Factory[T]): ...
|
||||
|
||||
|
|
@ -398,22 +394,22 @@ class BaseSingleton(Provider[T]):
|
|||
def provides(self) -> Optional[_Callable[..., T]]: ...
|
||||
def set_provides(
|
||||
self, provides: Optional[Union[_Callable[..., T], str]]
|
||||
) -> BaseSingleton[T]: ...
|
||||
) -> _Self: ...
|
||||
@property
|
||||
def args(self) -> Tuple[Injection]: ...
|
||||
def add_args(self, *args: Injection) -> BaseSingleton[T]: ...
|
||||
def set_args(self, *args: Injection) -> BaseSingleton[T]: ...
|
||||
def clear_args(self) -> BaseSingleton[T]: ...
|
||||
def add_args(self, *args: Injection) -> _Self: ...
|
||||
def set_args(self, *args: Injection) -> _Self: ...
|
||||
def clear_args(self) -> _Self: ...
|
||||
@property
|
||||
def kwargs(self) -> _Dict[str, Injection]: ...
|
||||
def add_kwargs(self, **kwargs: Injection) -> BaseSingleton[T]: ...
|
||||
def set_kwargs(self, **kwargs: Injection) -> BaseSingleton[T]: ...
|
||||
def clear_kwargs(self) -> BaseSingleton[T]: ...
|
||||
def add_kwargs(self, **kwargs: Injection) -> _Self: ...
|
||||
def set_kwargs(self, **kwargs: Injection) -> _Self: ...
|
||||
def clear_kwargs(self) -> _Self: ...
|
||||
@property
|
||||
def attributes(self) -> _Dict[Any, Injection]: ...
|
||||
def add_attributes(self, **kwargs: Injection) -> BaseSingleton[T]: ...
|
||||
def set_attributes(self, **kwargs: Injection) -> BaseSingleton[T]: ...
|
||||
def clear_attributes(self) -> BaseSingleton[T]: ...
|
||||
def attributes(self) -> _Dict[str, Injection]: ...
|
||||
def add_attributes(self, **kwargs: Injection) -> _Self: ...
|
||||
def set_attributes(self, **kwargs: Injection) -> _Self: ...
|
||||
def clear_attributes(self) -> _Self: ...
|
||||
def reset(self) -> SingletonResetContext[BS]: ...
|
||||
def full_reset(self) -> SingletonFullResetContext[BS]: ...
|
||||
|
||||
|
|
@ -435,9 +431,9 @@ class List(Provider[_List]):
|
|||
def __init__(self, *args: Injection): ...
|
||||
@property
|
||||
def args(self) -> Tuple[Injection]: ...
|
||||
def add_args(self, *args: Injection) -> List[T]: ...
|
||||
def set_args(self, *args: Injection) -> List[T]: ...
|
||||
def clear_args(self) -> List[T]: ...
|
||||
def add_args(self, *args: Injection) -> _Self: ...
|
||||
def set_args(self, *args: Injection) -> _Self: ...
|
||||
def clear_args(self) -> _Self: ...
|
||||
|
||||
class Dict(Provider[_Dict]):
|
||||
def __init__(
|
||||
|
|
@ -447,11 +443,11 @@ class Dict(Provider[_Dict]):
|
|||
def kwargs(self) -> _Dict[Any, Injection]: ...
|
||||
def add_kwargs(
|
||||
self, dict_: Optional[Mapping[Any, Injection]] = None, **kwargs: Injection
|
||||
) -> Dict: ...
|
||||
) -> _Self: ...
|
||||
def set_kwargs(
|
||||
self, dict_: Optional[Mapping[Any, Injection]] = None, **kwargs: Injection
|
||||
) -> Dict: ...
|
||||
def clear_kwargs(self) -> Dict: ...
|
||||
) -> _Self: ...
|
||||
def clear_kwargs(self) -> _Self: ...
|
||||
|
||||
class Resource(Provider[T]):
|
||||
@overload
|
||||
|
|
@ -512,17 +508,17 @@ class Resource(Provider[T]):
|
|||
) -> None: ...
|
||||
@property
|
||||
def provides(self) -> Optional[_Callable[..., Any]]: ...
|
||||
def set_provides(self, provides: Optional[Any]) -> Resource[T]: ...
|
||||
def set_provides(self, provides: Optional[Any]) -> _Self: ...
|
||||
@property
|
||||
def args(self) -> Tuple[Injection]: ...
|
||||
def add_args(self, *args: Injection) -> Resource[T]: ...
|
||||
def set_args(self, *args: Injection) -> Resource[T]: ...
|
||||
def clear_args(self) -> Resource[T]: ...
|
||||
def add_args(self, *args: Injection) -> _Self: ...
|
||||
def set_args(self, *args: Injection) -> _Self: ...
|
||||
def clear_args(self) -> _Self: ...
|
||||
@property
|
||||
def kwargs(self) -> _Dict[str, Injection]: ...
|
||||
def add_kwargs(self, **kwargs: Injection) -> Resource[T]: ...
|
||||
def set_kwargs(self, **kwargs: Injection) -> Resource[T]: ...
|
||||
def clear_kwargs(self) -> Resource[T]: ...
|
||||
def add_kwargs(self, **kwargs: Injection) -> _Self: ...
|
||||
def set_kwargs(self, **kwargs: Injection) -> _Self: ...
|
||||
def clear_kwargs(self) -> _Self: ...
|
||||
@property
|
||||
def initialized(self) -> bool: ...
|
||||
def init(self) -> Optional[Awaitable[T]]: ...
|
||||
|
|
@ -563,9 +559,7 @@ class ProvidedInstanceFluentInterface:
|
|||
def call(self, *args: Injection, **kwargs: Injection) -> MethodCaller: ...
|
||||
@property
|
||||
def provides(self) -> Optional[Provider]: ...
|
||||
def set_provides(
|
||||
self, provides: Optional[Provider]
|
||||
) -> ProvidedInstanceFluentInterface: ...
|
||||
def set_provides(self, provides: Optional[Provider]) -> _Self: ...
|
||||
|
||||
class ProvidedInstance(Provider, ProvidedInstanceFluentInterface):
|
||||
def __init__(self, provides: Optional[Provider] = None) -> None: ...
|
||||
|
|
@ -576,7 +570,7 @@ class AttributeGetter(Provider, ProvidedInstanceFluentInterface):
|
|||
) -> None: ...
|
||||
@property
|
||||
def name(self) -> Optional[str]: ...
|
||||
def set_name(self, name: Optional[str]) -> ProvidedInstanceFluentInterface: ...
|
||||
def set_name(self, name: Optional[str]) -> _Self: ...
|
||||
|
||||
class ItemGetter(Provider, ProvidedInstanceFluentInterface):
|
||||
def __init__(
|
||||
|
|
@ -584,7 +578,7 @@ class ItemGetter(Provider, ProvidedInstanceFluentInterface):
|
|||
) -> None: ...
|
||||
@property
|
||||
def name(self) -> Optional[str]: ...
|
||||
def set_name(self, name: Optional[str]) -> ProvidedInstanceFluentInterface: ...
|
||||
def set_name(self, name: Optional[str]) -> _Self: ...
|
||||
|
||||
class MethodCaller(Provider, ProvidedInstanceFluentInterface):
|
||||
def __init__(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user