Improve traverse() typing stubs

This commit is contained in:
Roman Mogylatov 2021-02-07 14:08:52 -05:00
parent 7d4172c144
commit 60ca4f53a2
2 changed files with 3 additions and 5 deletions

View File

@ -7,9 +7,7 @@ from typing import (
Union, Union,
ClassVar, ClassVar,
Callable as _Callable, Callable as _Callable,
Sequence,
Iterable, Iterable,
Iterator,
TypeVar, TypeVar,
Awaitable, Awaitable,
overload, overload,
@ -48,10 +46,10 @@ class Container:
def apply_container_providers_overridings(self) -> None: ... def apply_container_providers_overridings(self) -> None: ...
def reset_singletons(self) -> None: ... def reset_singletons(self) -> None: ...
@overload @overload
def traverse(self, types: Optional[Sequence[TT]] = None) -> Iterator[TT]: ... def traverse(self, types: Optional[Iterable[Type[TT]]] = None) -> _Iterator[TT]: ...
@classmethod @classmethod
@overload @overload
def traverse(cls, types: Optional[Sequence[TT]] = None) -> Iterator[TT]: ... def traverse(self, types: Optional[Iterable[Type[TT]]] = None) -> _Iterator[TT]: ...
class DynamicContainer(Container): ... class DynamicContainer(Container): ...

View File

@ -77,7 +77,7 @@ class Provider(Generic[T]):
def is_async_mode_undefined(self) -> bool: ... def is_async_mode_undefined(self) -> bool: ...
@property @property
def related(self) -> _Iterator[Provider]: ... def related(self) -> _Iterator[Provider]: ...
def traverse(self, types: Optional[_Iterable[TT]] = None) -> _Iterator[TT]: ... def traverse(self, types: Optional[_Iterable[Type[TT]]] = None) -> _Iterator[TT]: ...
def _copy_overridings(self, copied: Provider, memo: Optional[_Dict[Any, Any]]) -> None: ... def _copy_overridings(self, copied: Provider, memo: Optional[_Dict[Any, Any]]) -> None: ...