mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-10 10:26:31 +08:00
Specialize plain slice type hints (#13007)
This commit is contained in:
@@ -123,14 +123,14 @@ class Element(Generic[_Tag]):
|
||||
@overload
|
||||
def __getitem__(self, key: SupportsIndex, /) -> Element: ...
|
||||
@overload
|
||||
def __getitem__(self, key: slice, /) -> list[Element]: ...
|
||||
def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Element]: ...
|
||||
def __len__(self) -> int: ...
|
||||
# Doesn't actually exist at runtime, but instance of the class are indeed iterable due to __getitem__.
|
||||
def __iter__(self) -> Iterator[Element]: ...
|
||||
@overload
|
||||
def __setitem__(self, key: SupportsIndex, value: Element[Any], /) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, key: slice, value: Iterable[Element[Any]], /) -> None: ...
|
||||
def __setitem__(self, key: slice[SupportsIndex | None], value: Iterable[Element[Any]], /) -> None: ...
|
||||
|
||||
# Doesn't really exist in earlier versions, where __len__ is called implicitly instead
|
||||
@deprecated("Testing an element's truth value is deprecated.")
|
||||
|
||||
Reference in New Issue
Block a user