mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
xml: NodeList.length is read-only (#9994)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -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]: ...
|
||||
|
||||
Reference in New Issue
Block a user