Skip to content

Commit c3a880b

Browse files
[docutils] Add return types for a few docutils table methods (#14493)
1 parent 3514397 commit c3a880b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

stubs/docutils/docutils/parsers/rst/directives/tables.pyi

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import csv
22
from _typeshed import Incomplete
3-
from collections.abc import Callable
3+
from collections.abc import Callable, Sequence
44
from typing import ClassVar, Final
55

6+
from docutils import nodes
67
from docutils.parsers.rst import Directive
78

89
__docformat__: Final = "reStructuredText"
@@ -20,7 +21,7 @@ class Table(Directive):
2021
def extend_short_rows_with_empty_cells(self, columns, parts) -> None: ...
2122

2223
class RSTTable(Table):
23-
def run(self): ...
24+
def run(self) -> Sequence[nodes.table | nodes.system_message]: ...
2425

2526
class CSVTable(Table):
2627
class DocutilsDialect(csv.Dialect):
@@ -48,7 +49,7 @@ class CSVTable(Table):
4849
@staticmethod
4950
def check_requirements() -> None: ...
5051
def process_header_option(self): ...
51-
def run(self): ...
52+
def run(self) -> Sequence[nodes.table | nodes.system_message]: ...
5253
def get_csv_data(self): ...
5354
@staticmethod
5455
def decode_from_csv(s): ...
@@ -57,6 +58,6 @@ class CSVTable(Table):
5758
def parse_csv_data_into_rows(self, csv_data, dialect, source): ...
5859

5960
class ListTable(Table):
60-
def run(self): ...
61+
def run(self) -> Sequence[nodes.table | nodes.system_message]: ...
6162
def check_list_content(self, node): ...
62-
def build_table_from_list(self, table_data, col_widths, header_rows, stub_columns): ...
63+
def build_table_from_list(self, table_data, col_widths, header_rows, stub_columns) -> nodes.table: ...

stubs/docutils/docutils/parsers/rst/states.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class Body(RSTState):
219219
def isolate_grid_table(self): ...
220220
def isolate_simple_table(self): ...
221221
def malformed_table(self, block, detail: str = "", offset: int = 0): ...
222-
def build_table(self, tabledata, tableline, stub_columns: int = 0, widths=None): ...
222+
def build_table(self, tabledata, tableline, stub_columns: int = 0, widths=None) -> nodes.table: ...
223223
def build_table_row(self, rowdata, tableline): ...
224224
explicit: Incomplete
225225
def footnote(self, match): ...

0 commit comments

Comments
 (0)