-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[docutils] Add remaining node classes and functions #11255
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
Conversation
# Left out | ||
# - def ensure_str (deprecated) | ||
# - def unescape (canonical import from docutils.utils) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-explanatory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a history of leaving out deprecated symbols for third-party stubs, I'd say it's fine.
But if you want, you could use the typing_extensions.deprecated
decorator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in these two cases, it’s not necessary. One is for Python 2 only and therefore completely unnecessary, the other should just be imported from somewhere else, which is a single line change.
# - def ensure_str (deprecated) | ||
# - def unescape (canonical import from docutils.utils) | ||
|
||
class Text(Node, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this up so the module layout matches the source file.
This makes it easier to compare stubs and module code
def copy(self) -> Self: ... | ||
def deepcopy(self) -> Self: ... | ||
def pformat(self, indent: str = " ", level: int = 0) -> str: ... | ||
def astext(self) -> str: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As document
inherits these from Element
, duplicating these is not necessary.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
No idea what the “Test / Run mypy on the test cases” failure is about:
doesn’t look like anything I’ve touched. |
This comment has been minimized.
This comment has been minimized.
It's a known, unrelated issue: |
This reverts commit 5743214.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! A few – mostly nits – below.
Co-authored-by: Sebastian Rittau <[email protected]>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I don't like the mypy primer output. One of the problems is that we annotate elif isinstance(node, nodes.classifier) and not node.source:
# docutils-0.15 fills in rawsource attribute, but not in source.
node.source = node.parent.source In this case, it's valid to assume that I see two possible solutions:
|
In a fully parsed document, that assumption holds, but it’s always possible to create nodes whereever you want and use them. And these don’t have parents. I don’t like the “Any trick”. I do type checking to accurately handle all cases in my code. Corner cases like this are exactly what I want typing to be correct for: so I get notified that they exist and I can handle them before they become a problem. |
I invested quite some time into this. Sad to see all the conflicts being introduced. @adamtheturtle FYI this is a complete PR that adds all node classes, and you’re making this harder Unless anything is incorrect, can this please be merged and nitpicks and design choices deferred to later? |
This comment has been minimized.
This comment has been minimized.
I understand your feeling on this, and I agree, but, if you first introduce less disruptive changes (ie, by using the Any trick for example), then other maintainers are likely be more inclined to merge as-is (my understanding is that the primer output is the only thing blocking @srittau 's approval) |
Sounds good, I can do that. I wanted to discuss this, but I agree that merging this is higher priority than getting that specific facet right. |
This comment has been minimized.
This comment has been minimized.
Trying to cleanup the "messages only changes" in the last primer output ( - 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/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: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_term" of class "HTML5Translator":
+ 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:422:20: error: Item "Node" of "Union[Node, Any]" has no attribute "get" [union-attr]
+ sphinx/environment/adapters/toctree.py:426:21: error: Unsupported target for indexed assignment ("Node") [index]
+ 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:215:17: error: Item "Node" of "Union[Node, Any]" has no attribute "remove" [union-attr]
+ 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/transforms/i18n.py: note: In member "apply" of class "RemoveTranslatableInline":
+ sphinx/transforms/i18n.py:614:13: error: Item "Node" of "Union[Node, Any]" has no attribute "remove" [union-attr]
+ sphinx/transforms/i18n.py:615:13: error: Unsupported left operand type for + ("Node") [operator]
+ sphinx/transforms/i18n.py:615:13: note: Left operand is of type "Union[Node, Any]"
+ sphinx/search/__init__.py: note: In member "dispatch_visit" of class "WordCollector":
+ sphinx/search/__init__.py:234:19: error: Value of type "Union[Node, Any]" is not indexable [index]
+ 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/search/__init__.py: note: In function "_visit_nodes":
+ sphinx/search/__init__.py:506:23: error: Value of type "Union[Node, Any]" is not indexable [index]
+ sphinx/builders/_epub_base.py: note: In member "get_refnodes" of class "EpubBuilder":
+ sphinx/builders/_epub_base.py:196:23: error: Item "Node" of "Union[Node, Any]" has no attribute "attributes" [union-attr]
+ sphinx/builders/_epub_base.py: note: In function "add_visible_links":
+ sphinx/builders/_epub_base.py:329:24: error: Incompatible return value type (got "tuple[Union[Node, Any], Any]", expected "tuple[Element, int]") [return-value]
+ sphinx/builders/_epub_base.py:329:35: error: Item "Node" of "Union[Node, Any]" has no attribute "index" [union-attr]
+ sphinx/builders/_epub_base.py:332:28: error: Incompatible return value type (got "tuple[Union[Node, Any], Any]", expected "tuple[Element, int]") [return-value]
+ sphinx/builders/_epub_base.py:332:41: error: Item "Node" of "Union[Node, Any]" has no attribute "index" [union-attr]
+ sphinx/builders/_epub_base.py: note: In member "add_visible_links" of class "EpubBuilder":
+ sphinx/builders/_epub_base.py:348:23: error: Item "Node" of "Union[Node, Any]" has no attribute "index" [union-attr]
+ sphinx/builders/_epub_base.py:353:21: error: Item "Node" of "Union[Node, Any]" has no attribute "insert" [union-attr]
+ sphinx/builders/_epub_base.py:358:21: error: Item "Node" of "Union[Node, Any]" has no attribute "insert" [union-attr]
- 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:1240:41: error: Argument 1 to "get_nested_level" has incompatible type "Union[Node, Any]"; expected "Element" [arg-type]
+ 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/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/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/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: I think that something really interesting we can see with that primer output, is a lot of assumptions in sphinx code that a value will be a specific subclass of a Especially for Or type declarations ( |
Under the exact same reasoning of using "the Any trick", you could be cheeky and type @property
def parent(self) -> Self | Any: ...
@parent.setter
def parent(self, value: Node) -> None: ... Still more accurate/safer than just Whilst also reinforcing the argument of changing it back to Quick test: Avasam#38 (comment) Not sure what other maintainers think of it however. It feels real hacky. The new positives in the output are probably fine. |
The assumptions are probably there because a lot of subtrees are generated by Sphinx and therefore have a known structure. In that case, apart from some infeasible stack of generics, I don’t think the typing can be improved other than by some “trick”. Another facet is that some nodes do only appear in a certain configuration, e.g. a Most parents are |
And even then seems out of scope for this PR
That might be nice, as it would improve the known type and help prevent the user from creating invalid trees. But I haven't found where that's specified for every Node subclass and might be a rabbit hole of its own.
Agreed, my test above was more as a curiosity.
Not sure why The only non- Everything else seems like improvements to be done in sphinx itself (more runtime checks of expected types, or casting if they know their own structure) I'm a bit confused by |
You’re right, I thought Let’s see how this pans out! |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tentatively approving. The mypy_primer output now looks great.
With the exception of List item 0 has incompatible type "Generator[Node, None, None]";
new positives which are nonsensical to me looking at the source code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My previous points were addressed and the primer output looks good. Thanks, @flying-sheep and @Avasam for ironing out the remaining issues!
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:
|
I checked that everything is included using this little script: