Skip to content

Commit 0212302

Browse files
committed
fixup
1 parent 4556b65 commit 0212302

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

stubs/docutils/@tests/stubtest_allowlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ docutils.languages.LanguageImporter.__getattr__
99
docutils.nodes.Element.__getattr__
1010
docutils.nodes.GenericNodeVisitor.__getattr__
1111
docutils.nodes.Element.__iter__ # doesn't exist at runtime, but the class is iterable due to __getitem__
12+
docutils.statemachine.ViewList.__iter__ # doesn't exist at runtime, but the class is iterable due to __getitem__
1213
docutils.parsers.rst.Directive.__getattr__
1314
docutils.transforms.Transform.__getattr__
1415
docutils.transforms.Transformer.__getattr__

stubs/docutils/docutils/statemachine.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import re
21
from collections.abc import Callable, Generator, Iterator, Sequence
32
from re import Match, Pattern
43
from typing import Any, Generic, TypeAlias, TypeVar, overload
@@ -95,7 +94,6 @@ class StateWS(State):
9594
ws_patterns: dict[str, str]
9695
ws_initial_transitions: Sequence[str]
9796
def __init__(self, state_machine: StateMachine, debug: bool = False) -> None: ...
98-
patterns: dict[str, str | Pattern[str]]
9997
def add_initial_transitions(self) -> None: ...
10098
def blank(self, match: Match[str], context: Any, next_state: str) -> tuple[Any, str, Any]: ...
10199
def indent(self, match: Match[str], context: Any, next_state: str) -> tuple[Any, str, Any] | None: ...
@@ -164,6 +162,9 @@ class ViewList(Generic[_Data]):
164162
def xitems(self) -> Generator[tuple[str, int, str], None, None]: ...
165163
def pprint(self) -> None: ...
166164

165+
# dummy atribute to indicate to mypy that ViewList is Iterable[str]
166+
def __iter__(self) -> Iterator[str]: ...
167+
167168
class StringList(ViewList[str]):
168169
def trim_left(self, length: int, start: int = ..., end: int = ...) -> None: ...
169170
def get_text_block(self, start: int, flush_left: bool = ...) -> StringList: ...
@@ -179,9 +180,6 @@ class StringList(ViewList[str]):
179180
def pad_double_width(self, pad_char: str) -> None: ...
180181
def replace(self, old: str, new: str) -> None: ...
181182

182-
# dummy atribute to indicate to mypy that ViewList is Iterable[str]
183-
def __iter__(self) -> Iterator[str]: ...
184-
185183
class StateMachineError(Exception): ...
186184
class UnknownStateError(StateMachineError): ...
187185
class DuplicateStateError(StateMachineError): ...

0 commit comments

Comments
 (0)