mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-26 05:41:11 +08:00
xml.etree.ElementTree.Element: remove inheritance from MutableSequence (#8056)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -231,6 +231,8 @@ webbrowser.UnixBrowser.remote_action # always overridden in inheriting class
|
||||
webbrowser.UnixBrowser.remote_action_newtab # always overridden in inheriting class
|
||||
webbrowser.UnixBrowser.remote_action_newwin # always overridden in inheriting class
|
||||
xml.parsers.expat.expat_CAPI
|
||||
xml.etree.ElementTree.Element.__iter__ # Doesn't exist at runtime, but instances are iterable due to __getitem__
|
||||
xml.etree.cElementTree.Element.__iter__ # Doesn't exist at runtime, but instances are iterable due to __getitem__
|
||||
|
||||
# ==========
|
||||
# Exists at runtime, but missing from stubs
|
||||
|
||||
Reference in New Issue
Block a user