Skip to content

Commit 96e62dd

Browse files
authored
docutils: Use ClassVar for Directive class variables (#11550)
These are intended to be set as class variables, in subclasses of Directive, rather than instance variables. See also: - https://docutils.sourceforge.io/docs/howto/rst-directives.html#the-directive-class - https://docutils.sourceforge.io/docs/howto/rst-directives.html#admonitions
1 parent 4d8ae17 commit 96e62dd

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

stubs/Pygments/pygments/sphinxext.pyi

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Any
2-
31
from docutils.parsers.rst import Directive
42

53
MODULEDOC: str
@@ -8,15 +6,9 @@ FMTERDOC: str
86
FILTERDOC: str
97

108
class PygmentsDoc(Directive):
11-
has_content: bool
12-
required_arguments: int
13-
optional_arguments: int
14-
final_argument_whitespace: bool
15-
option_spec: Any
16-
filenames: Any
17-
def run(self): ...
18-
def document_lexers(self): ...
19-
def document_formatters(self): ...
20-
def document_filters(self): ...
9+
filenames: set[str]
10+
def document_lexers(self) -> str: ...
11+
def document_formatters(self) -> str: ...
12+
def document_filters(self) -> str: ...
2113

2214
def setup(app) -> None: ...

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class DirectiveError(Exception):
2424
def __init__(self, level: int, message: str) -> None: ...
2525

2626
class Directive:
27-
required_arguments: int
28-
optional_arguments: int
29-
final_argument_whitespace: bool
30-
option_spec: dict[str, Callable[[str], Any]] | None
31-
has_content: bool
27+
required_arguments: ClassVar[int]
28+
optional_arguments: ClassVar[int]
29+
final_argument_whitespace: ClassVar[bool]
30+
option_spec: ClassVar[dict[str, Callable[[str], Any]] | None]
31+
has_content: ClassVar[bool]
3232
name: str
3333
arguments: list[str]
3434
options: dict[str, Any]

0 commit comments

Comments
 (0)