Imporve dict typings

This commit is contained in:
ZipFile 2025-11-01 13:04:53 +00:00
parent 18e32521a0
commit 009a86de2c

View File

@ -1,23 +1,24 @@
from __future__ import annotations
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from contextlib import AbstractAsyncContextManager, AbstractContextManager
from pathlib import Path
from typing import (
Awaitable,
Generic,
Type,
Callable as _Callable,
Any,
Tuple,
List as _List,
Dict as _Dict,
Optional,
Union,
AsyncIterator as _AsyncIterator,
Awaitable,
Callable as _Callable,
Coroutine as _Coroutine,
Dict as _Dict,
Generator as _Generator,
Generic,
Iterable as _Iterable,
Iterator as _Iterator,
AsyncIterator as _AsyncIterator,
Generator as _Generator,
List as _List,
Mapping,
Optional,
Tuple,
Type,
Union,
overload,
)
@ -68,7 +69,7 @@ class Provider(Generic[T]):
@property
def provider(self) -> Provider[T]: ...
@property
def provided(self) -> ProvidedInstance[T]: ...
def provided(self) -> ProvidedInstance: ...
def enable_async_mode(self) -> None: ...
def disable_async_mode(self) -> None: ...
def reset_async_mode(self) -> None: ...
@ -106,7 +107,7 @@ class Delegate(Provider[Provider]):
class Aggregate(Provider[T]):
def __init__(
self,
provider_dict: Optional[_Dict[Any, Provider[T]]] = None,
provider_dict: Optional[Mapping[Any, Provider[T]]] = None,
**provider_kwargs: Provider[T],
): ...
def __getattr__(self, provider_name: Any) -> Provider[T]: ...
@ -125,7 +126,7 @@ class Aggregate(Provider[T]):
def providers(self) -> _Dict[Any, Provider[T]]: ...
def set_providers(
self,
provider_dict: Optional[_Dict[Any, Provider[T]]] = None,
provider_dict: Optional[Mapping[Any, Provider[T]]] = None,
**provider_kwargs: Provider[T],
) -> Aggregate[T]: ...
@ -183,7 +184,7 @@ class Callable(Provider[T]):
def set_args(self, *args: Injection) -> Callable[T]: ...
def clear_args(self) -> Callable[T]: ...
@property
def kwargs(self) -> _Dict[Any, Injection]: ...
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]: ...
@ -355,7 +356,7 @@ class Factory(Provider[T]):
def set_args(self, *args: Injection) -> Factory[T]: ...
def clear_args(self) -> Factory[T]: ...
@property
def kwargs(self) -> _Dict[Any, Injection]: ...
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]: ...
@ -379,7 +380,7 @@ class FactoryAggregate(Aggregate[T]):
def factories(self) -> _Dict[Any, Factory[T]]: ...
def set_factories(
self,
provider_dict: Optional[_Dict[Any, Factory[T]]] = None,
provider_dict: Optional[Mapping[Any, Factory[T]]] = None,
**provider_kwargs: Factory[T],
) -> FactoryAggregate[T]: ...
@ -404,7 +405,7 @@ class BaseSingleton(Provider[T]):
def set_args(self, *args: Injection) -> BaseSingleton[T]: ...
def clear_args(self) -> BaseSingleton[T]: ...
@property
def kwargs(self) -> _Dict[Any, Injection]: ...
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]: ...
@ -440,15 +441,15 @@ class List(Provider[_List]):
class Dict(Provider[_Dict]):
def __init__(
self, dict_: Optional[_Dict[Any, Injection]] = None, **kwargs: Injection
self, dict_: Optional[Mapping[Any, Injection]] = None, **kwargs: Injection
): ...
@property
def kwargs(self) -> _Dict[Any, Injection]: ...
def add_kwargs(
self, dict_: Optional[_Dict[Any, Injection]] = None, **kwargs: Injection
self, dict_: Optional[Mapping[Any, Injection]] = None, **kwargs: Injection
) -> Dict: ...
def set_kwargs(
self, dict_: Optional[_Dict[Any, Injection]] = None, **kwargs: Injection
self, dict_: Optional[Mapping[Any, Injection]] = None, **kwargs: Injection
) -> Dict: ...
def clear_kwargs(self) -> Dict: ...
@ -518,7 +519,7 @@ class Resource(Provider[T]):
def set_args(self, *args: Injection) -> Resource[T]: ...
def clear_args(self) -> Resource[T]: ...
@property
def kwargs(self) -> _Dict[Any, Injection]: ...
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]: ...