Skip to content

Commit 28ae6f8

Browse files
committed
fixup
1 parent eff97aa commit 28ae6f8

File tree

1 file changed

+33
-40
lines changed

1 file changed

+33
-40
lines changed

stubs/docutils/docutils/statemachine.pyi

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,20 @@ from typing_extensions import Self
66
__docformat__: str
77

88
_Context = TypeVar("_Context")
9-
_Result = TypeVar("_Result")
10-
_TransitionMethod: TypeAlias = Callable[[tuple[Match[str], _Context, str | None]], tuple[_Context, str | None, list[_Result]]]
11-
_TransitionResult: TypeAlias = tuple[_Context, str, list[_Result]]
9+
_TransitionMethod: TypeAlias = Callable[[Match[str], _Context, str], tuple[_Context, str | None, list[str]]]
10+
_TransitionResult: TypeAlias = tuple[_Context, str, list[str]]
1211

13-
class StateMachine(Generic[_Context, _Result]):
12+
class StateMachine(Generic[_Context]):
1413
input_lines: StringList | None
1514
input_offset: int
1615
line: str | None
1716
line_offset: int
1817
debug: bool
1918
initial_state: str
20-
current_state: list[State[_Context, _Result]]
21-
states: dict[str, State[_Context, _Result]]
19+
current_state: list[State[_Context]]
20+
states: dict[str, State[_Context]]
2221
observers: list[Callable[[Self], None]]
23-
def __init__(
24-
self, state_classes: Sequence[type[State[_Context, _Result]]], initial_state: str, debug: bool = False
25-
) -> None: ...
22+
def __init__(self, state_classes: Sequence[type[State[_Context]]], initial_state: str, debug: bool = False) -> None: ...
2623
def unlink(self) -> None: ...
2724
def run(
2825
self,
@@ -32,7 +29,7 @@ class StateMachine(Generic[_Context, _Result]):
3229
input_source: str | None = None,
3330
initial_state: str | None = None,
3431
) -> list[Any]: ...
35-
def get_state(self, next_state: str | None = None) -> State[_Context, _Result]: ...
32+
def get_state(self, next_state: str | None = None) -> State[_Context]: ...
3633
def next_line(self, n: int = 1) -> str: ...
3734
def is_next_line_blank(self) -> bool: ...
3835
def at_eof(self) -> bool: ...
@@ -46,26 +43,26 @@ class StateMachine(Generic[_Context, _Result]):
4643
def insert_input(self, input_lines: list[str] | StringList, source: str) -> None: ...
4744
def get_text_block(self, flush_left: bool = False) -> StringList: ...
4845
def check_line(
49-
self, context: _Context, state: State[_Context, _Result], transitions: list[str] | None = ...
50-
) -> _TransitionResult[_Context, _Result]: ...
51-
def add_state(self, state_class: type[State[_Context, _Result]]) -> None: ...
52-
def add_states(self, state_classes: Sequence[type[State[_Context, _Result]]]) -> None: ...
46+
self, context: _Context, state: State[_Context], transitions: list[str] | None = ...
47+
) -> _TransitionResult[_Context]: ...
48+
def add_state(self, state_class: type[State[_Context]]) -> None: ...
49+
def add_states(self, state_classes: Sequence[type[State[_Context]]]) -> None: ...
5350
def runtime_init(self) -> None: ...
5451
def error(self) -> None: ...
5552
def attach_observer(self, observer) -> None: ...
5653
def detach_observer(self, observer) -> None: ...
5754
def notify_observers(self) -> None: ...
5855

59-
class State(Generic[_Context, _Result]):
56+
class State(Generic[_Context]):
6057
patterns: dict[str, str | Pattern[str]] | None
6158
initial_transitions: Sequence[str] | Sequence[tuple[str, str]] | None
62-
nested_sm: type[StateMachine[_Context, _Result]] | None
59+
nested_sm: type[StateMachine[_Context]] | None
6360
nested_sm_kwargs: dict[str, Any] | None
6461
transition_order: list[str]
6562
transitions: dict[str, tuple[Pattern[str], Callable[[], None], str]]
66-
state_machine: StateMachine[_Context, _Result]
63+
state_machine: StateMachine[_Context]
6764
debug: bool
68-
def __init__(self, state_machine: StateMachine[_Context, _Result], debug: bool = False) -> None: ...
65+
def __init__(self, state_machine: StateMachine[_Context], debug: bool = False) -> None: ...
6966
def runtime_init(self) -> None: ...
7067
def unlink(self) -> None: ...
7168
def add_initial_transitions(self) -> None: ...
@@ -74,20 +71,18 @@ class State(Generic[_Context, _Result]):
7471
def remove_transition(self, name: str) -> None: ...
7572
def make_transition(
7673
self, name: str, next_state: str | None = None
77-
) -> tuple[Pattern[str], _TransitionMethod[_Context, _Result], str]: ...
74+
) -> tuple[Pattern[str], _TransitionMethod[_Context], str]: ...
7875
def make_transitions(
7976
self, name_list: list[str | tuple[str] | tuple[str, str]]
80-
) -> tuple[list[str], dict[str, tuple[Pattern[str], _TransitionMethod[_Context, _Result], str]]]: ...
77+
) -> tuple[list[str], dict[str, tuple[Pattern[str], _TransitionMethod[_Context], str]]]: ...
8178
def no_match(
82-
self,
83-
context: Any,
84-
transitions: tuple[list[str], dict[str, tuple[Pattern[str], _TransitionMethod[_Context, _Result], str]]],
85-
) -> _TransitionResult[_Context, _Result]: ...
86-
def bof(self, context: _Context) -> tuple[_Context, list[_Result]]: ...
87-
def eof(self, context: _Context) -> list[_Result]: ...
88-
def nop(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context, _Result]: ...
79+
self, context: Any, transitions: tuple[list[str], dict[str, tuple[Pattern[str], _TransitionMethod[_Context], str]]]
80+
) -> _TransitionResult[_Context]: ...
81+
def bof(self, context: _Context) -> tuple[_Context, list[str]]: ...
82+
def eof(self, context: _Context) -> list[str]: ...
83+
def nop(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context]: ...
8984

90-
class StateMachineWS(StateMachine[_Context, _Result]):
85+
class StateMachineWS(StateMachine[_Context]):
9186
def get_indented(self, until_blank: bool = False, strip_indent: bool = True) -> tuple[StringList, int, int, bool]: ...
9287
def get_known_indented(
9388
self, indent: int, until_blank: bool = False, strip_indent: bool = True
@@ -96,27 +91,25 @@ class StateMachineWS(StateMachine[_Context, _Result]):
9691
self, indent: int, until_blank: bool = False, strip_indent: bool = True, strip_top: bool = True
9792
) -> tuple[list[str], int, int, bool]: ...
9893

99-
class StateWS(State[_Context, _Result]):
100-
indent_sm: type[StateMachine[_Context, _Result]] | None
94+
class StateWS(State[_Context]):
95+
indent_sm: type[StateMachine[_Context]] | None
10196
indent_sm_kwargs: dict[str, Any] | None
102-
known_indent_sm: type[StateMachine[_Context, _Result]] | None
97+
known_indent_sm: type[StateMachine[_Context]] | None
10398
known_indent_sm_kwargs: dict[str, Any] | None
10499
ws_patterns: dict[str, str]
105100
ws_initial_transitions: Sequence[str]
106-
def __init__(self, state_machine: StateMachine[_Context, _Result], debug: bool = False) -> None: ...
101+
def __init__(self, state_machine: StateMachine[_Context], debug: bool = False) -> None: ...
107102
def add_initial_transitions(self) -> None: ...
108-
def blank(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context, _Result]: ...
109-
def indent(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context, _Result]: ...
110-
def known_indent(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context, _Result]: ...
111-
def first_known_indent(
112-
self, match: Match[str], context: _Context, next_state: str
113-
) -> _TransitionResult[_Context, _Result]: ...
103+
def blank(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context]: ...
104+
def indent(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context]: ...
105+
def known_indent(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context]: ...
106+
def first_known_indent(self, match: Match[str], context: _Context, next_state: str) -> _TransitionResult[_Context]: ...
114107

115108
class _SearchOverride:
116109
def match(self, pattern: Pattern[str]) -> Match[str]: ...
117110

118-
class SearchStateMachine(_SearchOverride, StateMachine[_Context, _Result]): ...
119-
class SearchStateMachineWS(_SearchOverride, StateMachineWS[_Context, _Result]): ...
111+
class SearchStateMachine(_SearchOverride, StateMachine[_Context]): ...
112+
class SearchStateMachineWS(_SearchOverride, StateMachineWS[_Context]): ...
120113

121114
_Data = TypeVar("_Data")
122115

0 commit comments

Comments
 (0)