Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

WIP: Impove docutils #14107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
Loading
from
Draft

WIP: Impove docutils #14107

wants to merge 10 commits into from

Conversation

donBarbos
Copy link
Contributor

No description provided.

This comment has been minimized.

adamtheturtle added a commit to adamtheturtle/typeshed that referenced this pull request May 21, 2025
Required to avoid adding new ignores to Sphinx with the latest types-docutils.
See sphinx-doc/sphinx#13564.

Copied form @donBarbos's WIP at python#14107.

This comment has been minimized.

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_directive.py:29: note: In module imported here:
+ src/bokeh/sphinxext/bokeh_color.py:45: note: ... from here:
+ src/bokeh/sphinxext/bokeh_color.py:45: note: ... from here:
+ src/bokeh/sphinxext/bokeh_color.py:45: note: In module imported here:
- src/bokeh/sphinxext/bokeh_palette_group.py:53: note: In module imported here:
+ src/bokeh/sphinxext/bokeh_palette_group.py:53: note: ... from here:

cwltool (https://github.com/common-workflow-language/cwltool)
+ ...:5: note: ... from here,
+ ...:141: note: ... from here,
+ ...:21: note: ... from here,
+ cwltool/software_requirements.py:23: note: ... from here:
+ ...:6: note: ... from here,
+ ...:141: note: ... from here,
+ ...:21: note: ... from here,
+ cwltool/software_requirements.py:23: note: ... from here:
+ ...:5: note: ... from here,
+ ...:141: note: ... from here,
+ ...:21: note: ... from here,
+ cwltool/software_requirements.py:23: note: ... from here:
+ ...:8: note: In module imported here,
+ ...:141: note: ... from here,
+ ...:21: note: ... from here,
+ cwltool/software_requirements.py:23: note: ... from here:

alectryon (https://github.com/cpitclaudel/alectryon)
+ alectryon/docutils.py:816: error: Cannot override instance variable (previously declared on base class "BasePseudoSection") with class variable  [misc]
+ alectryon/docutils.py:817: error: Cannot override instance variable (previously declared on base class "BasePseudoSection") with class variable  [misc]
- alectryon/docutils.py:1534: error: Unused "type: ignore" comment  [unused-ignore]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/directives/other.py:12: note: In module imported here:
+ sphinx/transforms/__init__.py:10: note: In module imported here:
+ sphinx/builders/html/__init__.py:23: note: In module imported here:
+ sphinx/builders/__init__.py:13: note: In module imported here:
+ sphinx/domains/__init__.py:22: note: In module imported here:
+ sphinx/builders/latex/nodes.py: note: In class "footnotetext":
+ sphinx/builders/latex/nodes.py:20:1: error: Definition of "referenced" in base class "Element" is incompatible with definition in base class "Targetable"  [misc]
+ sphinx/writers/html5.py:11: note: ... from here:
+ sphinx/writers/manpage.py:8: note: In module imported here:
+ sphinx/writers/html.py:7: note: In module imported here:
+ sphinx/builders/xml.py:9: note: In module imported here:
+ sphinx/writers/html5.py:11: note: In module imported here:
+ sphinx/directives/patches.py:10: note: In module imported here:
+ sphinx/util/docutils.py: note: In member "write" of class "SphinxFileOutput":
+ sphinx/util/docutils.py:453:16: error: Call to untyped function "write" in typed context  [no-untyped-call]
+ sphinx/util/docutils.py: note: In member "get_source_info" of class "SphinxDirective":
+ sphinx/util/docutils.py:488:16: error: Incompatible return value type (got "tuple[str, int] | tuple[None, None]", expected "tuple[str, int]")  [return-value]
+ sphinx/writers/html5.py:44: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/html5.py: note: In member "visit_reference" of class "HTML5Translator":
+ sphinx/writers/html5.py:334:32: error: Call to untyped function "cloak_mailto" in typed context  [no-untyped-call]
+ sphinx/writers/html5.py:350:57: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool"  [arg-type]
+ sphinx/writers/html5.py: note: In member "visit_comment" of class "HTML5Translator":
+ sphinx/writers/html5.py:364:5: error: Signature of "visit_comment" incompatible with supertype "HTMLTranslator"  [override]
+ sphinx/writers/html5.py:364:5: note:      Superclass:
+ sphinx/writers/html5.py:364:5: note:          def visit_comment(self, node: Any, sub: Any = ...) -> None
+ sphinx/writers/html5.py:364:5: note:      Subclass:
+ sphinx/writers/html5.py:364:5: note:          def visit_comment(self, node: Element) -> None
+ sphinx/writers/html5.py: note: In member "visit_admonition" of class "HTML5Translator":
+ sphinx/writers/html5.py:376:73: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool"  [arg-type]
+ sphinx/writers/html5.py: note: In member "visit_download_reference" of class "HTML5Translator":
+ sphinx/writers/html5.py:727:61: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool"  [arg-type]
+ sphinx/writers/html5.py:734:61: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool"  [arg-type]
+ sphinx/writers/html5.py: note: In member "visit_Text" of class "HTML5Translator":
+ sphinx/writers/html5.py:822:19: error: Call to untyped function "encode" in typed context  [no-untyped-call]
+ sphinx/writers/html5.py:838:27: error: Call to untyped function "cloak_email" in typed context  [no-untyped-call]
+ sphinx/writers/html5.py: note: In member "visit_abbreviation" of class "HTML5Translator":
+ sphinx/writers/html5.py:911:60: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool"  [arg-type]
+ sphinx/writers/html5.py: note: In member "visit_table" of class "HTML5Translator":
+ sphinx/writers/html5.py:936:71: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool"  [arg-type]
+ sphinx/writers/html.py:23: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/html.py: note: In member "translate" of class "HTMLWriter":
+ sphinx/writers/html.py:36:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/writers/html.py:37:23: error: Call to untyped function "astext" in typed context  [no-untyped-call]
+ sphinx/transforms/__init__.py:92: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:279:13: error: Unsupported target for indexed assignment ("Node")  [index]
+ sphinx/transforms/__init__.py: note: At top level:
- sphinx/transforms/__init__.py:393:5: error: Return type "Iterator[tuple[str, str]]" of "get_tokens" incompatible with return type "Generator[tuple[str, str], None, None]" in supertype "SmartQuotes"  [override]
+ sphinx/transforms/__init__.py:393:5: error: Return type "Iterator[tuple[str, str]]" of "get_tokens" incompatible with return type "Generator[Any, None, None]" in supertype "SmartQuotes"  [override]
+ sphinx/transforms/i18n.py: note: In function "publish_msgstr":
+ sphinx/transforms/i18n.py:88:20: error: Incompatible return value type (got "Node", expected "Element")  [return-value]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:108:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/builders/__init__.py: note: In member "read_doc" of class "Builder":
+ sphinx/builders/__init__.py:638:9: error: "dict[str, Any]" has no attribute "record_dependencies"  [attr-defined]
+ sphinx/builders/__init__.py:658:37: error: Argument 2 to "write_doctree" of "Builder" has incompatible type "Any | None"; expected "document"  [arg-type]
+ sphinx/io.py:40: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/io.py:40:24: error: Missing type parameters for generic type "Reader"  [type-arg]
+ sphinx/io.py:40:24: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/io.py:99: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/io.py: note: In member "read_source" of class "SphinxStandaloneReader":
+ sphinx/io.py:108:19: error: Item "None" of "Input[Any] | None" has no attribute "read"  [union-attr]
+ sphinx/builders/latex/__init__.py: note: In member "write_documents" of class "LaTeXBuilder":
+ sphinx/builders/latex/__init__.py:308:32: error: Call to untyped function "get_default_values" in typed context  [no-untyped-call]
+ sphinx/builders/html/__init__.py: note: In member "render_partial" of class "StandaloneHTMLBuilder":
+ sphinx/builders/html/__init__.py:430:16: error: Incompatible return value type (got "_WriterParts", expected "dict[str, str]")  [return-value]
+ sphinx/builders/html/__init__.py: note: In member "prepare_writing" of class "StandaloneHTMLBuilder":
+ sphinx/builders/html/__init__.py:452:37: error: Call to untyped function "get_default_values" in typed context  [no-untyped-call]
+ sphinx/writers/xml.py:15: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/xml.py: note: In member "translate" of class "XMLWriter":
+ sphinx/writers/xml.py:24:9: error: Item "None" of "document | None" has no attribute "settings"  [union-attr]
+ sphinx/writers/xml.py:27:9: error: Item "None" of "document | None" has no attribute "settings"  [union-attr]
+ sphinx/writers/xml.py:28:9: error: Item "None" of "document | None" has no attribute "settings"  [union-attr]
+ sphinx/writers/xml.py:33:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/writers/xml.py: note: At top level:
- sphinx/environment/collectors/toctree.py:87: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/xml.py:37: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/xml.py: note: In class "PseudoXMLWriter":
+ sphinx/writers/xml.py:38:5: error: Cannot override instance variable (previously declared on base class "Writer") with class variable  [misc]
+ sphinx/writers/xml.py:41:5: error: Cannot override instance variable (previously declared on base class "Writer") with class variable  [misc]
+ sphinx/writers/xml.py:42:5: error: Cannot override instance variable (previously declared on base class "Writer") with class variable  [misc]
+ sphinx/writers/xml.py: note: In member "translate" of class "PseudoXMLWriter":
+ sphinx/writers/xml.py:52:23: error: Item "None" of "document | None" has no attribute "pformat"  [union-attr]
+ sphinx/writers/manpage.py:29: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/manpage.py: note: In member "translate" of class "ManualPageWriter":
+ sphinx/writers/manpage.py:35:43: error: Argument 1 to "NestedInlineTransform" has incompatible type "document | None"; expected "document"  [arg-type]
+ sphinx/writers/manpage.py:39:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/writers/manpage.py:40:23: error: Call to untyped function "astext" in typed context  [no-untyped-call]
+ sphinx/writers/manpage.py: note: At top level:
+ sphinx/writers/manpage.py:74: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/manpage.py: note: In member "__init__" of class "ManualPageTranslator":
+ sphinx/writers/manpage.py:108:43: error: Call to untyped function "deunicode" in typed context  [no-untyped-call]
+ sphinx/writers/manpage.py: note: In member "visit_comment" of class "ManualPageTranslator":
+ sphinx/writers/manpage.py:248:5: error: Signature of "visit_comment" incompatible with supertype "Translator"  [override]
+ sphinx/writers/manpage.py:248:5: note:      Superclass:
+ sphinx/writers/manpage.py:248:5: note:          def visit_comment(self, node: Any, sub: Any = ...) -> None
+ sphinx/writers/manpage.py:248:5: note:      Subclass:
+ sphinx/writers/manpage.py:248:5: note:          def visit_comment(self, node: Element) -> None
+ sphinx/writers/manpage.py: note: In member "visit_rubric" of class "ManualPageTranslator":
+ sphinx/writers/manpage.py:260:39: error: Call to untyped function "deunicode" in typed context  [no-untyped-call]
+ sphinx/writers/manpage.py: note: In member "visit_title" of class "ManualPageTranslator":
+ sphinx/writers/manpage.py:437:40: error: Call to untyped function "deunicode" in typed context  [no-untyped-call]
+ sphinx/testing/restructuredtext.py: note: In function "parse":
+ sphinx/testing/restructuredtext.py:29:17: error: Argument 2 to "publish_doctree" has incompatible type "str"; expected "FileInput | StringInput | None"  [arg-type]
+ sphinx/ext/mathjax.py: note: In function "html_visit_math":
+ sphinx/ext/mathjax.py:42:11: error: Call to untyped function "encode" in typed context  [no-untyped-call]
+ sphinx/ext/mathjax.py: note: In function "html_visit_displaymath":
+ sphinx/ext/mathjax.py:52:26: error: Call to untyped function "encode" in typed context  [no-untyped-call]
+ sphinx/ext/mathjax.py:67:16: error: Call to untyped function "encode" in typed context  [no-untyped-call]
+ sphinx/ext/imgmath.py: note: In function "get_tooltip":
+ sphinx/ext/imgmath.py:331:25: error: Call to untyped function "encode" in typed context  [no-untyped-call]
+ sphinx/ext/imgmath.py: note: In function "html_visit_math":
+ sphinx/ext/imgmath.py:350:35: error: Call to untyped function "encode" in typed context  [no-untyped-call]
+ sphinx/ext/imgmath.py: note: In function "html_visit_displaymath":
+ sphinx/ext/imgmath.py:393:35: error: Call to untyped function "encode" in typed context  [no-untyped-call]
- sphinx/environment/collectors/title.py:53: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/directives/patches.py:33: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/directives/patches.py: note: In member "run" of class "Figure":
+ sphinx/directives/patches.py:42:20: error: Incompatible return value type (got "Sequence[Node]", expected "list[Node]")  [return-value]
+ sphinx/directives/patches.py: note: At top level:
+ sphinx/directives/patches.py:59: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/directives/patches.py: note: In member "run" of class "CSVTable":
+ sphinx/directives/patches.py:82:16: error: Call to untyped function "run" in typed context  [no-untyped-call]
+ sphinx/directives/other.py: note: In member "run" of class "Include":
+ sphinx/directives/other.py:409:13: error: Cannot assign to a method  [method-assign]
+ sphinx/directives/other.py:409:47: error: Incompatible types in assignment (expression has type "Callable[[list[str], str], None]", variable has type "Callable[[list[str] | StringList, str], None]")  [assignment]
+ sphinx/directives/code.py: note: In member "run" of class "CodeBlock":
+ sphinx/directives/code.py:146:74: error: Argument "location" to "dedent_lines" has incompatible type "tuple[str, int] | tuple[None, None]"; expected "tuple[str, int] | None"  [arg-type]
+ sphinx/directives/code.py: note: In member "run" of class "LiteralInclude":
+ sphinx/directives/code.py:462:48: error: Argument "location" to "read" of "LiteralIncludeReader" has incompatible type "tuple[str, int] | tuple[None, None]"; expected "tuple[str, int] | None"  [arg-type]
+ sphinx/builders/texinfo.py: note: In member "write_documents" of class "TexinfoBuilder":
+ sphinx/builders/texinfo.py:126:37: error: Call to untyped function "get_default_values" in typed context  [no-untyped-call]
+ sphinx/builders/latex/transforms.py:531: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/ext/graphviz.py: note: In function "render_dot_html":
+ sphinx/ext/graphviz.py:380:26: error: Call to untyped function "encode" in typed context  [no-untyped-call]
+ sphinx/ext/graphviz.py:384:35: error: Call to untyped function "encode" in typed context  [no-untyped-call]
+ sphinx/builders/manpage.py: note: In member "write_documents" of class "ManualPageBuilder":
+ sphinx/builders/manpage.py:61:32: error: Call to untyped function "get_default_values" in typed context  [no-untyped-call]
+ sphinx/builders/linkcheck.py: note: In member "run" of class "HyperlinkCollector":
+ sphinx/builders/linkcheck.py:216:37: error: Argument 1 to "find_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]
+ sphinx/builders/linkcheck.py:217:36: error: Argument 2 to "_add_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.