Skip to content

Commit 1c0e2d4

Browse files
committed
lie to mypy
1 parent afd209a commit 1c0e2d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stubs/docutils/docutils/nodes.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import xml.dom.minidom
22
from _typeshed import Incomplete
33
from abc import abstractmethod
4-
from collections.abc import Callable, Generator, Iterable, Sequence
4+
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
55
from typing import Any, ClassVar, Protocol, TypeVar, overload
66
from typing_extensions import Literal, Self
77

@@ -82,6 +82,9 @@ class Element(Node):
8282
def __init__(self, rawsource: str = "", *children: Node, **attributes): ...
8383
def __len__(self) -> int: ...
8484
def __contains__(self, key: str | Node) -> bool: ...
85+
# '__iter__' is added as workaround, since mypy doesn't support iterators defined using '__get_item__'
86+
# see https://github.com/python/typeshed/pull/10099#issuecomment-1528789395
87+
def __iter__(self) -> Iterator[Node]: ...
8588
@overload
8689
def __getitem__(self, key: str) -> Any: ...
8790
@overload

0 commit comments

Comments
 (0)