xml: NodeList.length is read-only (#9994)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Ali Hamdan
2023-04-01 00:55:46 +02:00
committed by GitHub
parent 34018d6a2c
commit 6bb40e95ac

View File

@@ -1,5 +1,6 @@
from collections.abc import Iterable
from typing import Any, TypeVar
from typing_extensions import Literal
__all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"]
@@ -8,11 +9,13 @@ _T = TypeVar("_T")
StringTypes: tuple[type[str]]
class NodeList(list[_T]):
length: int
@property
def length(self) -> int: ...
def item(self, index: int) -> _T | None: ...
class EmptyNodeList(tuple[Any, ...]):
length: int
class EmptyNodeList(tuple[()]):
@property
def length(self) -> Literal[0]: ...
def item(self, index: int) -> None: ...
def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore[override]
def __radd__(self, other: Iterable[_T]) -> NodeList[_T]: ...