Improve stubs for sequence types (#6386)

This commit is contained in:
Alex Waygood
2021-11-27 03:09:38 +00:00
committed by GitHub
parent 6130c2459e
commit 98af7d667f
9 changed files with 32 additions and 29 deletions

View File

@@ -16,7 +16,7 @@ from typing import (
Union,
overload,
)
from typing_extensions import Literal
from typing_extensions import Literal, SupportsIndex
_T = TypeVar("_T")
_File = Union[StrOrBytesPath, FileDescriptor, IO[Any]]
@@ -87,14 +87,14 @@ class Element(MutableSequence[Element]):
def makeelement(self, __tag: str, __attrib: dict[str, str]) -> Element: ...
def remove(self, __subelement: Element) -> None: ...
def set(self, __key: str, __value: str) -> None: ...
def __delitem__(self, i: int | slice) -> None: ...
def __delitem__(self, i: SupportsIndex | slice) -> None: ...
@overload
def __getitem__(self, i: int) -> Element: ...
def __getitem__(self, i: SupportsIndex) -> Element: ...
@overload
def __getitem__(self, s: slice) -> MutableSequence[Element]: ...
def __len__(self) -> int: ...
@overload
def __setitem__(self, i: int, o: Element) -> None: ...
def __setitem__(self, i: SupportsIndex, o: Element) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[Element]) -> None: ...
if sys.version_info < (3, 9):