Skip to content

Commit ae2c255

Browse files
committed
Solve Any issues
1 parent 3d1338d commit ae2c255

File tree

5 files changed

+25
-23
lines changed

5 files changed

+25
-23
lines changed

stubs/docutils/docutils/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ApplicationError(Exception): ...
2626
class DataError(ApplicationError): ...
2727

2828
class SettingsSpec:
29-
settings_spec: ClassVar[tuple[Any, ...]]
29+
settings_spec: ClassVar[tuple[Any, ...]] # Mixed tuple structure; uses Any for flexibility in nested option definitions
3030
settings_defaults: ClassVar[dict[Any, Any] | None]
3131
settings_default_overrides: ClassVar[dict[Any, Any] | None]
3232
relative_path_settings: ClassVar[tuple[Any, ...]]

stubs/docutils/docutils/parsers/__init__.pyi

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
from typing import Any, ClassVar, Final
1+
from typing import ClassVar, Final
22

33
from docutils import Component
4-
from docutils.nodes import document as _document
4+
from docutils.nodes import _Document
55

66
__docformat__: Final = "reStructuredText"
77

88
class Parser(Component):
9-
settings_spec: ClassVar[tuple[Any, ...]]
109
component_type: ClassVar[str]
1110
config_section: ClassVar[str]
12-
inputstring: Any # defined after call to setup_parse()
13-
document: Any # defined after call to setup_parse()
14-
def parse(self, inputstring: str, document: _document) -> None: ...
15-
def setup_parse(self, inputstring: str, document: _document) -> None: ...
11+
inputstring: str # defined after call to setup_parse()
12+
document: _Document # defined after call to setup_parse()
13+
def parse(self, inputstring: str, document: _Document) -> None: ...
14+
def setup_parse(self, inputstring: str, document: _Document) -> None: ...
1615
def finish_parse(self) -> None: ...
1716

1817
_parser_aliases: dict[str, str]

stubs/docutils/docutils/parsers/rst/__init__.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from _typeshed import Incomplete
12
from collections.abc import Callable, Sequence
23
from typing import Any, ClassVar, Final, Literal
34
from typing_extensions import TypeAlias
@@ -11,7 +12,6 @@ from docutils.utils import Reporter
1112
__docformat__: Final = "reStructuredText"
1213

1314
class Parser(parsers.Parser):
14-
settings_spec: ClassVar[tuple[Any, ...]]
1515
config_section_dependencies: ClassVar[tuple[str, ...]]
1616
initial_state: Literal["Body", "RFC2822Body"]
1717
state_classes: Sequence[type[RSTState]]
@@ -34,7 +34,7 @@ class Directive:
3434
has_content: ClassVar[bool]
3535
name: str
3636
arguments: list[str]
37-
options: dict[str, Any]
37+
options: dict[str, Incomplete]
3838
content: StringList
3939
lineno: int
4040
content_offset: int
@@ -46,7 +46,7 @@ class Directive:
4646
self,
4747
name: str,
4848
arguments: list[str],
49-
options: dict[str, Any],
49+
options: dict[str, Incomplete],
5050
content: StringList,
5151
lineno: int,
5252
content_offset: int,
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
from collections.abc import Callable
2-
from typing import Any, ClassVar, Final
2+
from typing import ClassVar, Final
3+
from typing_extensions import TypeAlias
34

45
from docutils import nodes
56
from docutils.parsers.rst import Directive
67

78
__docformat__: Final = "reStructuredText"
89

10+
_DirectiveFn: TypeAlias = Callable[[str | None], str | list[str]]
11+
912
class BasePseudoSection(Directive):
10-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
13+
option_spec: ClassVar[dict[str, _DirectiveFn]]
1114
node_class: ClassVar[type[nodes.Node] | None]
1215
def run(self): ...
1316

@@ -16,27 +19,27 @@ class Topic(BasePseudoSection):
1619

1720
class Sidebar(BasePseudoSection):
1821
node_class: ClassVar[type[nodes.Node]]
19-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
22+
option_spec: ClassVar[dict[str, _DirectiveFn]]
2023
def run(self): ...
2124

2225
class LineBlock(Directive):
23-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
26+
option_spec: ClassVar[dict[str, _DirectiveFn]]
2427
def run(self): ...
2528

2629
class ParsedLiteral(Directive):
27-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
30+
option_spec: ClassVar[dict[str, _DirectiveFn]]
2831
def run(self): ...
2932

3033
class CodeBlock(Directive):
31-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
34+
option_spec: ClassVar[dict[str, _DirectiveFn]]
3235
def run(self): ...
3336

3437
class MathBlock(Directive):
35-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
38+
option_spec: ClassVar[dict[str, _DirectiveFn]]
3639
def run(self): ...
3740

3841
class Rubric(Directive):
39-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
42+
option_spec: ClassVar[dict[str, _DirectiveFn]]
4043
def run(self): ...
4144

4245
class BlockQuote(Directive):
@@ -53,9 +56,9 @@ class PullQuote(BlockQuote):
5356
classes: ClassVar[list[str]]
5457

5558
class Compound(Directive):
56-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
59+
option_spec: ClassVar[dict[str, _DirectiveFn]]
5760
def run(self): ...
5861

5962
class Container(Directive):
60-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
63+
option_spec: ClassVar[dict[str, _DirectiveFn]]
6164
def run(self): ...

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import csv
22
from _typeshed import Incomplete
33
from collections.abc import Callable
4-
from typing import Any, ClassVar, Final
4+
from typing import ClassVar, Final
55

66
from docutils.parsers.rst import Directive
77

@@ -10,7 +10,7 @@ __docformat__: Final = "reStructuredText"
1010
def align(argument): ...
1111

1212
class Table(Directive):
13-
option_spec: ClassVar[dict[str, Callable[[str], Any]]]
13+
option_spec: ClassVar[dict[str, Callable[[str | None], str | list[str]]]]
1414
def make_title(self): ...
1515
def check_table_dimensions(self, rows, header_rows, stub_columns) -> None: ...
1616
def set_table_width(self, table_node) -> None: ...

0 commit comments

Comments
 (0)