From 694c982b4f0ea5787d5879cd66f1e86b0075f89d Mon Sep 17 00:00:00 2001 From: danieleades <33452915+danieleades@users.noreply.github.com> Date: Tue, 9 Jul 2024 13:00:57 +0100 Subject: [PATCH] improve type annotations in 'docutils.parsers.rst.states' (#11545) --- .../docutils/docutils/parsers/rst/states.pyi | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/stubs/docutils/docutils/parsers/rst/states.pyi b/stubs/docutils/docutils/parsers/rst/states.pyi index 8d9ae920e..93b706272 100644 --- a/stubs/docutils/docutils/parsers/rst/states.pyi +++ b/stubs/docutils/docutils/parsers/rst/states.pyi @@ -1,12 +1,12 @@ from _typeshed import Incomplete -from collections.abc import Callable, Sequence +from collections.abc import Callable, Iterable, Sequence from re import Match, Pattern from types import ModuleType from typing import Any from typing_extensions import TypeAlias from docutils import nodes -from docutils.statemachine import StateMachineWS, StateWS +from docutils.statemachine import StateMachine, StateMachineWS, StateWS from docutils.utils import Reporter class Struct: @@ -18,27 +18,27 @@ class RSTState(StateWS[list[str]]): nested_sm_kwargs: Incomplete def __init__(self, state_machine, debug: bool = False) -> None: ... memo: Incomplete - reporter: Incomplete - inliner: Incomplete + reporter: Reporter + inliner: Inliner document: nodes.document parent: Incomplete def runtime_init(self) -> None: ... - def goto_line(self, abs_line_offset) -> None: ... - def no_match(self, context, transitions): ... - def bof(self, context): ... + def goto_line(self, abs_line_offset: int) -> None: ... + def no_match(self, context: list[str], transitions): ... + def bof(self, context: list[str]): ... def nested_parse( self, block, - input_offset, + input_offset: int, node, match_titles: bool = False, - state_machine_class: Incomplete | None = None, + state_machine_class: type[StateMachine[list[str]]] | None = None, state_machine_kwargs: Incomplete | None = None, ): ... def nested_list_parse( self, block, - input_offset, + input_offset: int, node, initial_state, blank_finish, @@ -48,13 +48,13 @@ class RSTState(StateWS[list[str]]): state_machine_class: Incomplete | None = None, state_machine_kwargs: Incomplete | None = None, ): ... - def section(self, title, source, style, lineno, messages) -> None: ... - def check_subsection(self, source, style, lineno): ... - def title_inconsistent(self, sourcetext, lineno): ... - def new_subsection(self, title, lineno, messages) -> None: ... - def paragraph(self, lines, lineno): ... - def inline_text(self, text, lineno): ... - def unindent_warning(self, node_name): ... + def section(self, title: str, source, style, lineno: int, messages) -> None: ... + def check_subsection(self, source, style, lineno: int): ... + def title_inconsistent(self, sourcetext: str, lineno: int): ... + def new_subsection(self, title: str, lineno: int, messages) -> None: ... + def paragraph(self, lines: Iterable[str], lineno: int): ... + def inline_text(self, text: str, lineno: int): ... + def unindent_warning(self, node_name: str): ... def build_regexp(definition, compile: bool = True): ...