xml.etree.ElementTree.Element: remove inheritance from MutableSequence (#8056)

This commit is contained in:
Alex Waygood
2022-06-13 11:22:28 +01:00
committed by GitHub
parent 70d903c8b6
commit 67828bd598
2 changed files with 9 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import sys
from _collections_abc import dict_keys
from _typeshed import FileDescriptor, StrOrBytesPath, SupportsRead, SupportsWrite
from collections.abc import Callable, Generator, ItemsView, Iterable, Iterator, KeysView, Mapping, MutableSequence, Sequence
from collections.abc import Callable, Generator, ItemsView, Iterable, Iterator, Mapping, Sequence
from typing import Any, TypeVar, overload
from typing_extensions import Literal, SupportsIndex, TypeAlias, TypeGuard
@@ -80,7 +81,7 @@ if sys.version_info >= (3, 8):
exclude_tags: Iterable[str] | None = ...,
) -> None: ...
class Element(MutableSequence[Element]):
class Element:
tag: str
attrib: dict[str, str]
text: str | None
@@ -104,7 +105,7 @@ class Element(MutableSequence[Element]):
def iter(self, tag: str | None = ...) -> Generator[Element, None, None]: ...
def iterfind(self, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ...
def itertext(self) -> Generator[str, None, None]: ...
def keys(self) -> KeysView[str]: ...
def keys(self) -> dict_keys[str, str]: ...
# makeelement returns the type of self in Python impl, but not in C impl
def makeelement(self, __tag: str, __attrib: dict[str, str]) -> Element: ...
def remove(self, __subelement: Element) -> None: ...
@@ -115,8 +116,10 @@ class Element(MutableSequence[Element]):
@overload
def __getitem__(self, __i: SupportsIndex) -> Element: ...
@overload
def __getitem__(self, __s: slice) -> MutableSequence[Element]: ...
def __getitem__(self, __s: slice) -> 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, __i: SupportsIndex, __o: Element) -> None: ...
@overload