Skip to content
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

test docutils #38

Closed
wants to merge 21 commits into from
Closed

test docutils #38

wants to merge 21 commits into from

Conversation

Avasam
Copy link
Owner

@Avasam Avasam commented Jan 27, 2024

No description provided.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link

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

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/addnodes.py: note: At top level:
- sphinx/addnodes.py:172: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/util/nodes.py: note: In function "apply_source_workaround":
+ sphinx/util/nodes.py:130:21: error: Unsupported operand types for - ("None" and "int")  [operator]
+ sphinx/util/nodes.py:130:21: note: Left operand is of type "Union[int, None, Any]"
+ sphinx/util/nodes.py: note: At top level:
- sphinx/util/nodes.py: note: In function "traverse_parent":
- sphinx/util/nodes.py:295:16: error: Incompatible types in assignment (expression has type "Optional[Node]", variable has type "Element")  [assignment]
- sphinx/util/nodes.py: note: In function "get_prev_node":
- sphinx/util/nodes.py:299:11: error: Item "Node" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/util/nodes.py:299:11: error: Item "None" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/util/nodes.py:301:16: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/util/nodes.py: note: In function "clean_astext":
- sphinx/util/nodes.py:345:9: error: Item "Node" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/util/nodes.py:345:9: error: Item "None" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/util/nodes.py: note: In function "inline_all_toctrees":
- sphinx/util/nodes.py:435:9: error: Item "Node" of "Optional[Node]" has no attribute "replace"  [union-attr]
- sphinx/util/nodes.py:435:9: error: Item "None" of "Optional[Node]" has no attribute "replace"  [union-attr]
- sphinx/util/nodes.py: note: In function "is_smartquotable":
- sphinx/util/nodes.py:596:34: error: Argument 1 to "traverse_parent" has incompatible type "Optional[Node]"; expected "Element"  [arg-type]
+ sphinx/util/docutils.py: note: In function "register_role":
+ sphinx/util/docutils.py:104:37: error: Argument 2 to "register_local_role" has incompatible type "Callable[[str, str, str, int, Inliner, dict[str, Any], Sequence[str]], tuple[list[Node], list[system_message]]]"; expected "Callable[[str, str, str, int, Inliner, dict[str, Any], list[str]], tuple[list[reference], list[reference]]]"  [arg-type]
- sphinx/util/docutils.py:267:22: error: Incompatible types in assignment (expression has type "Callable[[str, Module, int, Reporter], tuple[Callable[[str, str, str, int, Inliner, dict[str, Any], Sequence[str]], tuple[list[Node], list[system_message]]], list[system_message]]]", variable has type "Callable[[str, _LanguageModule, int, Reporter], tuple[Optional[Callable[[str, str, str, int, Inliner, dict[str, Any], list[str]], tuple[list[Any], list[Any]]]], list[SystemMessage]]]")  [assignment]
+ sphinx/util/docutils.py:267:22: error: Incompatible types in assignment (expression has type "Callable[[str, Module, int, Reporter], tuple[Callable[[str, str, str, int, Inliner, dict[str, Any], Sequence[str]], tuple[list[Node], list[system_message]]], list[system_message]]]", variable has type "Callable[[str, _LanguageModule, int, Reporter], tuple[Optional[Callable[[str, str, str, int, Inliner, dict[str, Any], list[str]], tuple[list[reference], list[reference]]]], list[SystemMessage]]]")  [assignment]
- sphinx/util/docutils.py:124: error: Unused "type: ignore" comment  [unused-ignore]
- sphinx/util/docutils.py: note: In member "dispatch_visit" of class "SphinxTranslator":
- sphinx/util/docutils.py:588:13: error: "dispatch_visit" undefined in superclass  [misc]
- sphinx/util/docutils.py: note: In member "dispatch_departure" of class "SphinxTranslator":
- sphinx/util/docutils.py:605:13: error: "dispatch_departure" undefined in superclass  [misc]
- sphinx/util/docutils.py: note: In function "new_document":
- sphinx/util/docutils.py:636:44: error: Argument 2 to "document" has incompatible type "Reporter"; expected "Node"  [arg-type]
- sphinx/writers/html5.py: note: In member "depart_desc_signature_line" of class "HTML5Translator":
- sphinx/writers/html5.py:109:36: error: Argument 1 to "add_permalink_ref" of "HTML5Translator" has incompatible type "Optional[Node]"; expected "Element"  [arg-type]
- sphinx/writers/html5.py: note: At top level:
- sphinx/writers/html5.py: note: In member "depart_term" of class "HTML5Translator":
- sphinx/writers/html5.py:460:27: error: Item "None" of "Optional[Node]" has no attribute "parent"  [union-attr]
- sphinx/writers/html5.py:460:27: error: Item "None" of "Union[Node, None, Any]" has no attribute "parent"  [union-attr]
- sphinx/writers/html5.py: note: In member "visit_title" of class "HTML5Translator":
- sphinx/writers/html5.py:475:28: error: Argument 1 to "add_fignumber" of "HTML5Translator" has incompatible type "Optional[Node]"; expected "Element"  [arg-type]
- sphinx/writers/html5.py: note: In member "depart_title" of class "HTML5Translator":
- sphinx/writers/html5.py:482:17: error: Item "Node" of "Optional[Node]" has no attribute "hasattr"  [union-attr]
- sphinx/writers/html5.py:482:17: error: Item "None" of "Optional[Node]" has no attribute "hasattr"  [union-attr]
- sphinx/writers/html5.py:482:48: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/writers/html5.py:485:40: error: Argument 1 to "add_permalink_ref" of "HTML5Translator" has incompatible type "Optional[Node]"; expected "Element"  [arg-type]
- sphinx/writers/html5.py:488:34: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/writers/html5.py: note: In member "visit_caption" of class "HTML5Translator":
- sphinx/writers/html5.py:529:28: error: Argument 1 to "add_fignumber" of "HTML5Translator" has incompatible type "Optional[Node]"; expected "Element"  [arg-type]
- sphinx/writers/html5.py: note: In member "depart_caption" of class "HTML5Translator":
- sphinx/writers/html5.py:540:14: error: Item "Node" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/writers/html5.py:540:14: error: Item "None" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/writers/html5.py:541:36: error: Item "None" of "Optional[Node]" has no attribute "parent"  [union-attr]
- sphinx/writers/html5.py:541:36: error: Argument 1 to "add_permalink_ref" of "HTML5Translator" has incompatible type "Union[Node, None, Any]"; expected "Element"  [arg-type]
- sphinx/transforms/__init__.py: note: In function "_reorder_index_target_nodes":
- sphinx/transforms/__init__.py:475:21: error: Item "Node" of "Union[Any, Node, None]" has no attribute "index"  [union-attr]
- sphinx/transforms/__init__.py:475:21: error: Item "None" of "Union[Any, Node, None]" has no attribute "index"  [union-attr]
- sphinx/transforms/__init__.py:476:20: error: Item "Node" of "Union[Any, Node, None]" has no attribute "index"  [union-attr]
- sphinx/transforms/__init__.py:476:20: error: Item "None" of "Union[Any, Node, None]" has no attribute "index"  [union-attr]
- sphinx/transforms/__init__.py:478:13: error: Unsupported target for indexed assignment ("Union[Any, Node, None]")  [index]
+ sphinx/roles.py: note: In function "setup":
+ sphinx/roles.py:445:45: error: Argument 2 to "register_local_role" has incompatible type "Callable[[str, str, str, int, Inliner, dict[str, Any], Sequence[str]], tuple[list[Node], list[system_message]]]"; expected "Callable[[str, str, str, int, Inliner, dict[str, Any], list[str]], tuple[list[reference], list[reference]]]"  [arg-type]
- sphinx/environment/adapters/toctree.py:169: error: Unused "type: ignore" comment  [unused-ignore]
- sphinx/environment/adapters/toctree.py: note: In function "_entries_from_toctree":
- sphinx/environment/adapters/toctree.py:253:23: error: Item "Node" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/environment/adapters/toctree.py:253:23: error: Item "None" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/environment/adapters/toctree.py:255:17: error: Item "Node" of "Optional[Node]" has no attribute "insert"  [union-attr]
- sphinx/environment/adapters/toctree.py:255:17: error: Item "None" of "Optional[Node]" has no attribute "insert"  [union-attr]
- sphinx/environment/adapters/toctree.py:256:13: error: Item "Node" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/environment/adapters/toctree.py:256:13: error: Item "None" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/environment/adapters/toctree.py: note: In function "_toctree_add_classes":
- sphinx/environment/adapters/toctree.py:420:38: error: Incompatible types in assignment (expression has type "Optional[Node]", variable has type "Element")  [assignment]
- sphinx/environment/__init__.py:647:17: error: Item "Node" of "Optional[Node]" has no attribute "replace"  [union-attr]
- sphinx/environment/__init__.py:647:17: error: Item "None" of "Optional[Node]" has no attribute "replace"  [union-attr]
- sphinx/domains/python/_object.py: note: In member "_toc_entry_name" of class "PyObject":
- sphinx/domains/python/_object.py:414:19: error: Item "Node" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/domains/python/_object.py:414:19: error: Item "None" of "Optional[Node]" has no attribute "get"  [union-attr]
+ sphinx/transforms/i18n.py: note: In member "update_title_mapping" of class "_NodeUpdater":
+ sphinx/transforms/i18n.py:185:17: error: Incompatible types in assignment (expression has type "Node", variable has type "target")  [assignment]
+ sphinx/transforms/i18n.py: note: In member "update_autofootnote_references" of class "_NodeUpdater":
+ sphinx/transforms/i18n.py:202:14: error: List item 0 has incompatible type "Generator[Node, None, None]"; expected "footnote_reference"  [list-item]
+ sphinx/transforms/i18n.py:204:14: error: List item 0 has incompatible type "Generator[Node, None, None]"; expected "footnote_reference"  [list-item]
+ sphinx/transforms/i18n.py: note: In member "update_refnamed_references" of class "_NodeUpdater":
+ sphinx/transforms/i18n.py:243:45: error: List item 0 has incompatible type "Generator[Node, None, None]"; expected "reference"  [list-item]
+ sphinx/transforms/i18n.py:244:45: error: List item 0 has incompatible type "Generator[Node, None, None]"; expected "reference"  [list-item]
+ sphinx/transforms/i18n.py: note: In member "update_refnamed_footnote_references" of class "_NodeUpdater":
+ sphinx/transforms/i18n.py:267:59: error: List item 0 has incompatible type "Generator[Node, None, None]"; expected "footnote_reference"  [list-item]
+ sphinx/transforms/i18n.py:269:59: error: List item 0 has incompatible type "Generator[Node, None, None]"; expected "footnote_reference"  [list-item]
+ sphinx/transforms/i18n.py: note: In member "update_citation_references" of class "_NodeUpdater":
+ sphinx/transforms/i18n.py:285:59: error: List item 0 has incompatible type "Generator[Node, None, None]"; expected "citation_reference"  [list-item]
+ sphinx/transforms/i18n.py:286:59: error: List item 0 has incompatible type "Generator[Node, None, None]"; expected "citation_reference"  [list-item]
+ sphinx/transforms/i18n.py:414:59: error: Argument 4 to "publish_msgstr" has incompatible type "Optional[int]"; expected "int"  [arg-type]
+ sphinx/transforms/i18n.py:417:66: error: Argument 5 to "make_glossary_term" has incompatible type "Optional[int]"; expected "int"  [arg-type]
+ sphinx/transforms/i18n.py:480:36: error: Argument 4 to "publish_msgstr" has incompatible type "Optional[int]"; expected "int"  [arg-type]
+ sphinx/transforms/i18n.py:446: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/search/__init__.py: note: In member "dispatch_visit" of class "WordCollector":
+ sphinx/search/__init__.py:237:62: error: Argument 1 to "_is_meta_keywords" has incompatible type "Element"; expected "meta"  [arg-type]
+ sphinx/search/__init__.py: note: At top level:
- sphinx/writers/latex.py: note: In member "visit_title" of class "LaTeXTranslator":
- sphinx/writers/latex.py:642:64: error: Argument 1 to "hypertarget_to" of "LaTeXTranslator" has incompatible type "Optional[Node]"; expected "Element"  [arg-type]
- sphinx/writers/latex.py: note: In function "_visit_signature_line":
- sphinx/writers/latex.py:710:24: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/writers/latex.py:710:33: error: Item "Node" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/latex.py:710:33: error: Item "None" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/latex.py: note: In member "visit_desc_signature" of class "LaTeXTranslator":
- sphinx/writers/latex.py:760:12: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/writers/latex.py: note: In member "visit_entry" of class "LaTeXTranslator":
- sphinx/writers/latex.py:1163:23: error: Item "None" of "Optional[Node]" has no attribute "parent"  [union-attr]
- sphinx/writers/latex.py: note: In function "visit_enumerated_list":
- sphinx/writers/latex.py:1242:41: error: Argument 1 to "get_nested_level" has incompatible type "Optional[Node]"; expected "Element"  [arg-type]
- sphinx/writers/latex.py: note: In member "visit_paragraph" of class "LaTeXTranslator":
- sphinx/writers/latex.py:1331:17: error: Item "Node" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/latex.py:1331:17: error: Item "None" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/latex.py: note: In member "visit_image" of class "LaTeXTranslator":
- sphinx/writers/latex.py:1401:40: error: Argument 1 to "is_inline" of "LaTeXTranslator" has incompatible type "Optional[Node]"; expected "Element"  [arg-type]
- sphinx/writers/latex.py: note: In member "visit_caption" of class "LaTeXTranslator":
- sphinx/writers/latex.py:1532:29: error: Item "Node" of "Optional[Node]" has no attribute "tagname"  [union-attr]
- sphinx/writers/latex.py:1532:29: error: Item "None" of "Optional[Node]" has no attribute "tagname"  [union-attr]
- sphinx/writers/latex.py: note: In function "visit_target":
- sphinx/writers/latex.py:1606:21: error: Item "Node" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/latex.py:1606:21: error: Item "None" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/latex.py:1607:41: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/ext/todo.py: note: In member "process" of class "TodoListProcessor":
- sphinx/ext/todo.py:138:17: error: Item "Node" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/ext/todo.py:138:17: error: Item "None" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/domains/rst.py: note: In member "_toc_entry_name" of class "ReSTMarkup":
- sphinx/domains/rst.py:79:19: error: Item "Node" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/domains/rst.py:79:19: error: Item "None" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/domains/javascript.py: note: In member "_toc_entry_name" of class "JSObject":
- sphinx/domains/javascript.py:234:19: error: Item "Node" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/domains/javascript.py:234:19: error: Item "None" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/domains/index.py: note: In member "process_doc" of class "IndexDomain":
+ sphinx/domains/citation.py: note: In member "note_citation" of class "CitationDomain":
+ sphinx/domains/citation.py:72:33: error: Incompatible types in assignment (expression has type "tuple[Any, Any, Optional[int]]", target has type "tuple[str, str, int]")  [assignment]
- sphinx/domains/index.py:56:17: error: Item "Node" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/domains/index.py:56:17: error: Item "None" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/domains/cpp/_ast.py: note: In member "describe_signature" of class "ASTParametersQualifiers":
- sphinx/domains/cpp/_ast.py:1621:29: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
- sphinx/domains/c/_ast.py: note: In member "describe_signature" of class "ASTParameters":
- sphinx/domains/c/_ast.py:639:29: error: Incompatible types in assignment (expression has type "Node", variable has type "Element")  [assignment]
- sphinx/domains/cpp/__init__.py: note: In member "_toc_entry_name" of class "CPPObject":
- sphinx/domains/cpp/__init__.py:310:19: error: "Node" has no attribute "get"  [attr-defined]
- sphinx/writers/manpage.py:60:23: error: Item "Node" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/manpage.py:60:23: error: Item "None" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/manpage.py:64:25: error: Item "Node" of "Optional[Node]" has no attribute "insert"  [union-attr]
- sphinx/writers/manpage.py:64:25: error: Item "None" of "Optional[Node]" has no attribute "insert"  [union-attr]
- sphinx/writers/manpage.py:67:25: error: Item "Node" of "Optional[Node]" has no attribute "insert"  [union-attr]
- sphinx/writers/manpage.py:67:25: error: Item "None" of "Optional[Node]" has no attribute "insert"  [union-attr]
- sphinx/writers/manpage.py:70:21: error: Item "Node" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/writers/manpage.py:70:21: error: Item "None" of "Optional[Node]" has no attribute "remove"  [union-attr]
- sphinx/ext/autosectionlabel.py: note: In function "get_node_depth":
- sphinx/ext/autosectionlabel.py:27:20: error: Incompatible types in assignment (expression has type "Optional[Node]", variable has type "Node")  [assignment]
- sphinx/ext/autodoc/typehints.py: note: In function "merge_typehints":
- sphinx/ext/autodoc/typehints.py:52:51: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/environment/collectors/toctree.py: note: In function "process_doc":
- sphinx/environment/collectors/toctree.py:123:36: error: Item "Node" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/environment/collectors/toctree.py:123:36: error: Item "None" of "Optional[Node]" has no attribute "get"  [union-attr]
- sphinx/writers/texinfo.py: note: In member "visit_target" of class "TexinfoTranslator":
- sphinx/writers/texinfo.py:664:20: error: Item "Node" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/texinfo.py:664:20: error: Item "None" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/writers/texinfo.py:667:24: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/writers/texinfo.py:671:24: error: Item "None" of "Optional[Node]" has no attribute "parent"  [union-attr]
- sphinx/writers/texinfo.py:671:24: error: Value of type "Union[Node, None, Any]" is not indexable  [index]
- sphinx/writers/texinfo.py:671:43: error: Item "Node" of "Union[Node, None, Any]" has no attribute "index"  [union-attr]
- sphinx/writers/texinfo.py:671:43: error: Item "None" of "Union[Node, None, Any]" has no attribute "index"  [union-attr]
- sphinx/writers/texinfo.py: note: In member "visit_desc_signature" of class "TexinfoTranslator":
+ sphinx/writers/texinfo.py: note: In member "collect_node_names" of class "TexinfoTranslator":
+ sphinx/writers/texinfo.py:284:45: error: Value of type variable "_N" of "next_node" of "Node" cannot be "Titular"  [type-var]
- sphinx/writers/texinfo.py:1402:19: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/writers/texinfo.py:1408:50: error: Value of type "Optional[Node]" is not indexable  [index]
- sphinx/builders/latex/transforms.py: note: In member "get_docname_for_node" of class "ShowUrlsTransform":
- sphinx/builders/latex/transforms.py:114:24: error: Incompatible types in assignment (expression has type "Optional[Node]", variable has type "Node")  [assignment]
- sphinx/builders/latex/transforms.py: note: At top level:
- sphinx/builders/latex/transforms.py: note: In member "unrestrict" of class "LaTeXFootnoteVisitor":
- sphinx/builders/latex/transforms.py:394:19: error: Item "Node" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/builders/latex/transforms.py:394:19: error: Item "None" of "Optional[Node]" has no attribute "index"  [union-attr]
- sphinx/builders/latex/transforms.py:397:17: error: Item "Node" of "Optional[Node]" has no attribute "insert"  [union-attr]
- sphinx/builders/latex/transforms.py:397:17: error: Item "None" of "Optional[Node]" has no attribute "insert"  [union-attr]

bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/sphinxext/bokeh_roles.py:65: note: In module imported here:

@Avasam Avasam closed this Jan 29, 2024
@Avasam Avasam deleted the add-node-classes branch February 29, 2024 00:26
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.

3 participants