Skip to content

Commit 67176a4

Browse files
danieleadesdaniel.eades
andauthored
improve type annotations in 'docutils.parsers.rst.tableparser' (#11530)
Co-authored-by: daniel.eades <[email protected]>
1 parent 82fd9e8 commit 67176a4

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
from re import Pattern
2+
from typing import ClassVar
3+
from typing_extensions import TypeAlias
4+
5+
from docutils import DataError
6+
from docutils.statemachine import Stringlist
7+
8+
_Cell: TypeAlias = tuple[int, int, int, list[str]]
9+
_Row: TypeAlias = list[_Cell | None]
10+
_Colspecs: TypeAlias = list[int]
11+
12+
__docformat__: str
13+
14+
class TableMarkupError(DataError):
15+
offset: int
16+
def __init__(self, *args, **kwargs) -> None: ...
17+
18+
class TableParser:
19+
head_body_separator_pat: ClassVar[Pattern[str] | None]
20+
double_width_pad_char: ClassVar[str]
21+
def parse(self, block: Stringlist) -> tuple[_Colspecs, list[_Row], list[_Row]]: ...
22+
def find_head_body_sep(self) -> None: ...
23+
24+
class GridTableParser(TableParser):
25+
head_body_separator_pat: ClassVar[Pattern[str]]
26+
block: Stringlist
27+
bottom: int
28+
right: int
29+
head_body_sep: int
30+
done: list[int]
31+
cells: list[_Cell]
32+
rowseps: dict[int, list[int]]
33+
colseps: dict[int, list[int]]
34+
def setup(self, block: Stringlist) -> None: ...
35+
def parse_table(self) -> None: ...
36+
def mark_done(self, top: int, left: int, bottom: int, right: int) -> None: ...
37+
def check_parse_complete(self) -> bool: ...
38+
def scan_cell(self, top: int, left: int) -> tuple[int, int, dict[int, list[int]], dict[int, list[int]]]: ...
39+
def scan_right(self, top: int, left: int) -> tuple[int, int, dict[int, list[int]], dict[int, list[int]]]: ...
40+
def scan_down(self, top: int, left: int, right: int) -> tuple[int, dict[int, list[int]], dict[int, list[int]]]: ...
41+
def scan_left(self, top: int, left: int, bottom: int, right: int) -> tuple[dict[int, list[int]], dict[int, list[int]]]: ...
42+
def scan_up(self, top: int, left: int, bottom: int, right: int) -> dict[int, list[int]]: ...
43+
def structure_from_cells(self) -> tuple[_Colspecs, list[_Row], list[_Row]]: ...
44+
45+
class SimpleTableParser(TableParser):
46+
head_body_separator_pat: ClassVar[Pattern[str]]
47+
span_pat: ClassVar[Pattern[str]]
48+
block: Stringlist
49+
head_body_sep: int
50+
columns: list[tuple[int, int]]
51+
border_end: int
52+
table: tuple[list[int], list[_Row], list[_Row]]
53+
done: list[int]
54+
rowseps: dict[int, tuple[int]]
55+
colseps: dict[int, tuple[int]]
56+
def setup(self, block: Stringlist) -> None: ...
57+
def parse_table(self) -> None: ...
58+
def parse_columns(self, line: str, offset: int) -> list[tuple[int, int]]: ...
59+
def init_row(self, colspec: list[tuple[int, int]], offset: int) -> list[_Cell]: ...
60+
def parse_row(self, lines: list[str], start: int, spanline: tuple[str, int] | None = ...) -> None: ...
61+
def check_columns(self, lines: list[str], first_line: int, columns: list[tuple[int, int]]) -> None: ...
62+
def structure_from_cells(self) -> tuple[_Colspecs, list[_Row], list[_Row]]: ...
63+
64+
def update_dict_of_lists(master: dict[int, list[int]], newdata: dict[int, list[int]]) -> None: ...

0 commit comments

Comments
 (0)