From 96e62dd7573dd56a614fb02564167347a8ca8dad Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 9 Mar 2024 16:28:35 -0600 Subject: [PATCH] `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 --- stubs/Pygments/pygments/sphinxext.pyi | 16 ++++------------ stubs/docutils/docutils/parsers/rst/__init__.pyi | 10 +++++----- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/stubs/Pygments/pygments/sphinxext.pyi b/stubs/Pygments/pygments/sphinxext.pyi index ef79a1ea8..cf43911fc 100644 --- a/stubs/Pygments/pygments/sphinxext.pyi +++ b/stubs/Pygments/pygments/sphinxext.pyi @@ -1,5 +1,3 @@ -from typing import Any - from docutils.parsers.rst import Directive MODULEDOC: str @@ -8,15 +6,9 @@ FMTERDOC: str FILTERDOC: str class PygmentsDoc(Directive): - has_content: bool - required_arguments: int - optional_arguments: int - final_argument_whitespace: bool - option_spec: Any - filenames: Any - def run(self): ... - def document_lexers(self): ... - def document_formatters(self): ... - def document_filters(self): ... + filenames: set[str] + def document_lexers(self) -> str: ... + def document_formatters(self) -> str: ... + def document_filters(self) -> str: ... def setup(app) -> None: ... diff --git a/stubs/docutils/docutils/parsers/rst/__init__.pyi b/stubs/docutils/docutils/parsers/rst/__init__.pyi index 3eb4ef963..2d5d619ff 100644 --- a/stubs/docutils/docutils/parsers/rst/__init__.pyi +++ b/stubs/docutils/docutils/parsers/rst/__init__.pyi @@ -24,11 +24,11 @@ class DirectiveError(Exception): def __init__(self, level: int, message: str) -> None: ... class Directive: - required_arguments: int - optional_arguments: int - final_argument_whitespace: bool - option_spec: dict[str, Callable[[str], Any]] | None - has_content: bool + required_arguments: ClassVar[int] + optional_arguments: ClassVar[int] + final_argument_whitespace: ClassVar[bool] + option_spec: ClassVar[dict[str, Callable[[str], Any]] | None] + has_content: ClassVar[bool] name: str arguments: list[str] options: dict[str, Any]