docutils: add nodes.General; make Element iterable (#10099)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
danieleadesandAlex Waygood authored and GitHub committed 2023-04-29 15:43:39 +01:00
1 parent 40975222b4
commit 9772c425a2
2 files changed
+7 -1

No files matched your search

+6 -1
View File
@@ -1,7 +1,7 @@
import xml.dom.minidom
from _typeshed import Incomplete
from abc import abstractmethod
from collections.abc import Callable, Generator, Iterable, Sequence
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
from typing import Any, ClassVar, Protocol, TypeVar, overload
from typing_extensions import Literal, Self
@@ -82,6 +82,9 @@ class Element(Node):
def __init__(self, rawsource: str = "", *children: Node, **attributes): ...
def __len__(self) -> int: ...
def __contains__(self, key: str | Node) -> bool: ...
# '__iter__' is added as workaround, since mypy doesn't support classes that are iterable via '__getitem__'
# see https://github.com/python/typeshed/pull/10099#issuecomment-1528789395
def __iter__(self) -> Iterator[Node]: ...
@overload
def __getitem__(self, key: str) -> Any: ...
@overload
@@ -120,6 +123,8 @@ class Text(Node, str):
def lstrip(self, chars: str | None = None) -> str: ...
class Structural: ...
class Body: ...
class General(Body): ...
class Root: ...
class document(Root, Structural, Element):