mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-12-01 22:14:04 +03:00
Improve .traverse() typing stubs
This commit is contained in:
parent
78f623c05b
commit
b4ac08819e
|
@ -7,6 +7,11 @@ that were made in every particular version.
|
|||
From version 0.7.6 *Dependency Injector* framework strictly
|
||||
follows `Semantic versioning`_
|
||||
|
||||
Development version
|
||||
-------------------
|
||||
- Improve ``container.traverse(types=[...])`` and ``provider.traverse(types=[...])`` typing stubs
|
||||
to return ``types`` -typed iterator.
|
||||
|
||||
4.18.0
|
||||
------
|
||||
- Add ``container.reset_singleton()`` method to reset container singletons.
|
||||
|
|
|
@ -21,6 +21,7 @@ from .providers import Provider
|
|||
C_Base = TypeVar('C_Base', bound='Container')
|
||||
C = TypeVar('C', bound='DeclarativeContainer')
|
||||
C_Overriding = TypeVar('C_Overriding', bound='DeclarativeContainer')
|
||||
TT = TypeVar('TT')
|
||||
|
||||
|
||||
class Container:
|
||||
|
@ -46,10 +47,10 @@ class Container:
|
|||
def apply_container_providers_overridings(self) -> None: ...
|
||||
def reset_singletons(self) -> None: ...
|
||||
@overload
|
||||
def traverse(self, types: Optional[Sequence[Type]] = None) -> Iterator[Provider]: ...
|
||||
def traverse(self, types: Optional[Sequence[TT]] = None) -> Iterator[TT]: ...
|
||||
@classmethod
|
||||
@overload
|
||||
def traverse(cls, types: Optional[Sequence[Type]] = None) -> Iterator[Provider]: ...
|
||||
def traverse(cls, types: Optional[Sequence[TT]] = None) -> Iterator[TT]: ...
|
||||
|
||||
|
||||
class DynamicContainer(Container): ...
|
||||
|
|
|
@ -36,6 +36,7 @@ from . import resources
|
|||
|
||||
Injection = Any
|
||||
T = TypeVar('T')
|
||||
TT = TypeVar('TT')
|
||||
|
||||
|
||||
class OverridingContext:
|
||||
|
@ -76,7 +77,7 @@ class Provider(Generic[T]):
|
|||
def is_async_mode_undefined(self) -> bool: ...
|
||||
@property
|
||||
def related(self) -> _Iterator[Provider]: ...
|
||||
def traverse(self, types: Optional[_Iterable[Type]] = None) -> _Iterator[Provider]: ...
|
||||
def traverse(self, types: Optional[_Iterable[TT]] = None) -> _Iterator[TT]: ...
|
||||
def _copy_overridings(self, copied: Provider, memo: Optional[_Dict[Any, Any]]) -> None: ...
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user