mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Improve stubs for sequence types (#6386)
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user