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