[docutils] Add missing stubs for `writers` dir
Diff from mypy_primer, showing the effect of this PR on open source code:
sphinx (https://github.com/sphinx-doc/sphinx)
+ 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:350:57: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool" [arg-type]
- sphinx/writers/html5.py:361:31: error: Argument 1 to "depart_reference" of "NodeVisitor" has incompatible type "Element"; expected "reference" [arg-type]
+ sphinx/writers/html5.py:361:31: error: Argument 1 to "depart_reference" of "HTMLTranslator" has incompatible type "Element"; expected "reference" [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: comment, sub: Callable[[str, str], str] = ...) -> 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:458:35: error: Argument 1 to "visit_bullet_list" of "NodeVisitor" has incompatible type "Element"; expected "bullet_list" [arg-type]
+ sphinx/writers/html5.py:458:35: error: Argument 1 to "visit_bullet_list" of "HTMLTranslator" has incompatible type "Element"; expected "bullet_list" [arg-type]
- sphinx/writers/html5.py:521:33: error: Argument 1 to "visit_title" of "NodeVisitor" has incompatible type "Element"; expected "title" [arg-type]
+ sphinx/writers/html5.py:521:33: error: Argument 1 to "visit_title" of "HTMLTranslator" has incompatible type "Element"; expected "title" [arg-type]
- sphinx/writers/html5.py:562:30: error: Argument 1 to "depart_title" of "NodeVisitor" has incompatible type "Element"; expected "title" [arg-type]
+ sphinx/writers/html5.py:562:30: error: Argument 1 to "depart_title" of "HTMLTranslator" has incompatible type "Element"; expected "title" [arg-type]
- sphinx/writers/html5.py:592:48: error: Argument 1 to "visit_literal_block" of "NodeVisitor" has incompatible type "Element"; expected "literal_block" [arg-type]
+ sphinx/writers/html5.py:592:48: error: Argument 1 to "visit_literal_block" of "HTMLTranslator" has incompatible type "Element"; expected "literal_block" [arg-type]
- sphinx/writers/html5.py:624:35: error: Argument 1 to "visit_caption" of "NodeVisitor" has incompatible type "Element"; expected "caption" [arg-type]
+ sphinx/writers/html5.py:624:35: error: Argument 1 to "visit_caption" of "HTMLTranslator" has incompatible type "Element"; expected "caption" [arg-type]
- sphinx/writers/html5.py:648:36: error: Argument 1 to "depart_caption" of "NodeVisitor" has incompatible type "Element"; expected "caption" [arg-type]
+ sphinx/writers/html5.py:648:36: error: Argument 1 to "depart_caption" of "HTMLTranslator" has incompatible type "Element"; expected "caption" [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:747:37: error: Argument 1 to "visit_figure" of "NodeVisitor" has incompatible type "Element"; expected "figure" [arg-type]
+ sphinx/writers/html5.py:747:37: error: Argument 1 to "visit_figure" of "HTMLTranslator" has incompatible type "Element"; expected "figure" [arg-type]
- sphinx/writers/html5.py:775:29: error: Argument 1 to "visit_image" of "NodeVisitor" has incompatible type "Element"; expected "image" [arg-type]
+ sphinx/writers/html5.py:775:29: error: Argument 1 to "visit_image" of "HTMLTranslator" has incompatible type "Element"; expected "image" [arg-type]
- sphinx/writers/html5.py:782:34: error: Argument 1 to "depart_image" of "NodeVisitor" has incompatible type "Element"; expected "image" [arg-type]
+ sphinx/writers/html5.py:782:34: error: Argument 1 to "depart_image" of "HTMLTranslator" has incompatible type "Element"; expected "image" [arg-type]
- sphinx/writers/html5.py:896:36: error: Argument 1 to "visit_emphasis" of "NodeVisitor" has incompatible type "Element"; expected "emphasis" [arg-type]
+ sphinx/writers/html5.py:896:36: error: Argument 1 to "visit_emphasis" of "HTMLTranslator" has incompatible type "Element"; expected "emphasis" [arg-type]
- sphinx/writers/html5.py:899:37: error: Argument 1 to "depart_emphasis" of "NodeVisitor" has incompatible type "Element"; expected "emphasis" [arg-type]
+ sphinx/writers/html5.py:899:37: error: Argument 1 to "depart_emphasis" of "HTMLTranslator" has incompatible type "Element"; expected "emphasis" [arg-type]
- sphinx/writers/html5.py:902:34: error: Argument 1 to "visit_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/html5.py:902:34: error: Argument 1 to "visit_strong" of "HTMLTranslator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/html5.py:905:35: error: Argument 1 to "depart_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/html5.py:905:35: error: Argument 1 to "depart_strong" of "HTMLTranslator" has incompatible type "Element"; expected "strong" [arg-type]
+ 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/html5.py:941:30: error: Argument 1 to "depart_table" of "NodeVisitor" has incompatible type "Element"; expected "table" [arg-type]
+ sphinx/writers/html5.py:941:30: error: Argument 1 to "depart_table" of "HTMLTranslator" has incompatible type "Element"; expected "table" [arg-type]
- sphinx/writers/html5.py:954:41: error: Argument 1 to "visit_field_list" of "NodeVisitor" has incompatible type "Element"; expected "field_list" [arg-type]
+ sphinx/writers/html5.py:954:41: error: Argument 1 to "visit_field_list" of "HTMLTranslator" has incompatible type "Element"; expected "field_list" [arg-type]
- sphinx/writers/html5.py:958:42: error: Argument 1 to "depart_field_list" of "NodeVisitor" has incompatible type "Element"; expected "field_list" [arg-type]
+ sphinx/writers/html5.py:958:42: error: Argument 1 to "depart_field_list" of "HTMLTranslator" has incompatible type "Element"; expected "field_list" [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/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:32:9: error: Incompatible types in assignment (expression has type "NodeVisitor", variable has type "XMLTranslator") [assignment]
+ 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/writers/xml.py:37: error: Unused "type: ignore" comment [unused-ignore]
+ 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: note: At top level:
- sphinx/writers/manpage.py:134:36: error: Argument 1 to "visit_definition_list" of "NodeVisitor" has incompatible type "Element"; expected "definition_list" [arg-type]
+ sphinx/writers/manpage.py:134:36: error: Argument 1 to "visit_definition_list" of "Translator" has incompatible type "Element"; expected "definition_list" [arg-type]
- sphinx/writers/manpage.py:137:37: error: Argument 1 to "depart_definition_list" of "NodeVisitor" has incompatible type "Element"; expected "definition_list" [arg-type]
+ sphinx/writers/manpage.py:137:37: error: Argument 1 to "depart_definition_list" of "Translator" has incompatible type "Element"; expected "definition_list" [arg-type]
- sphinx/writers/manpage.py:140:41: error: Argument 1 to "visit_definition_list_item" of "NodeVisitor" has incompatible type "Element"; expected "definition_list_item" [arg-type]
+ sphinx/writers/manpage.py:140:41: error: Argument 1 to "visit_definition_list_item" of "Translator" has incompatible type "Element"; expected "definition_list_item" [arg-type]
- sphinx/writers/manpage.py:144:26: error: Argument 1 to "depart_term" of "NodeVisitor" has incompatible type "Element"; expected "term" [arg-type]
+ sphinx/writers/manpage.py:144:26: error: Argument 1 to "depart_term" of "Translator" has incompatible type "Element"; expected "term" [arg-type]
- sphinx/writers/manpage.py:153:31: error: Argument 1 to "visit_definition" of "NodeVisitor" has incompatible type "Element"; expected "definition" [arg-type]
+ sphinx/writers/manpage.py:153:31: error: Argument 1 to "visit_definition" of "Translator" has incompatible type "Element"; expected "definition" [arg-type]
- sphinx/writers/manpage.py:156:32: error: Argument 1 to "depart_definition" of "NodeVisitor" has incompatible type "Element"; expected "definition" [arg-type]
+ sphinx/writers/manpage.py:156:32: error: Argument 1 to "depart_definition" of "Translator" has incompatible type "Element"; expected "definition" [arg-type]
- sphinx/writers/manpage.py:235:30: error: Argument 1 to "visit_paragraph" of "NodeVisitor" has incompatible type "Element"; expected "paragraph" [arg-type]
+ sphinx/writers/manpage.py:235:30: error: Argument 1 to "visit_paragraph" of "Translator" has incompatible type "Element"; expected "paragraph" [arg-type]
- sphinx/writers/manpage.py:238:31: error: Argument 1 to "depart_paragraph" of "NodeVisitor" has incompatible type "Element"; expected "paragraph" [arg-type]
+ sphinx/writers/manpage.py:238:31: error: Argument 1 to "depart_paragraph" of "Translator" has incompatible type "Element"; expected "paragraph" [arg-type]
- sphinx/writers/manpage.py:245:32: error: Argument 1 to "visit_term" of "NodeVisitor" has incompatible type "Element"; expected "term" [arg-type]
+ sphinx/writers/manpage.py:245:32: error: Argument 1 to "visit_term" of "Translator" has incompatible type "Element"; expected "term" [arg-type]
- sphinx/writers/manpage.py:248:5: note: def visit_comment(self, node: comment, sub: _RegexPatternSub = ...) -> Never
+ sphinx/writers/manpage.py:248:5: note: def visit_comment(self, node: comment, sub: _RegexPatternSub = ...) -> None
- sphinx/writers/manpage.py:254:32: error: Argument 1 to "visit_footnote" of "NodeVisitor" has incompatible type "Element"; expected "footnote" [arg-type]
+ sphinx/writers/manpage.py:254:32: error: Argument 1 to "visit_footnote" of "Translator" has incompatible type "Element"; expected "footnote" [arg-type]
- sphinx/writers/manpage.py:271:32: error: Argument 1 to "depart_admonition" of "NodeVisitor" has incompatible type "Element"; expected "admonition" [arg-type]
+ sphinx/writers/manpage.py:271:32: error: Argument 1 to "depart_admonition" of "Translator" has incompatible type "Element"; expected "admonition" [arg-type]
- sphinx/writers/manpage.py:304:25: error: Argument 1 to "visit_Text" of "NodeVisitor" has incompatible type "Element"; expected "Text" [arg-type]
+ sphinx/writers/manpage.py:304:25: error: Argument 1 to "visit_Text" of "Translator" has incompatible type "Element"; expected "Text" [arg-type]
+ sphinx/writers/manpage.py:305:26: error: Tuple index out of range [misc]
+ sphinx/writers/manpage.py:315:21: error: Tuple index out of range [misc]
- sphinx/writers/manpage.py:373:32: error: Argument 1 to "visit_bullet_list" of "NodeVisitor" has incompatible type "Element"; expected "bullet_list" [arg-type]
+ sphinx/writers/manpage.py:373:32: error: Argument 1 to "visit_bullet_list" of "Translator" has incompatible type "Element"; expected "bullet_list" [arg-type]
- sphinx/writers/manpage.py:376:33: error: Argument 1 to "depart_bullet_list" of "NodeVisitor" has incompatible type "Element"; expected "bullet_list" [arg-type]
+ sphinx/writers/manpage.py:376:33: error: Argument 1 to "depart_bullet_list" of "Translator" has incompatible type "Element"; expected "bullet_list" [arg-type]
- sphinx/writers/manpage.py:385:36: error: Argument 1 to "visit_emphasis" of "NodeVisitor" has incompatible type "Element"; expected "emphasis" [arg-type]
+ sphinx/writers/manpage.py:385:36: error: Argument 1 to "visit_emphasis" of "Translator" has incompatible type "Element"; expected "emphasis" [arg-type]
- sphinx/writers/manpage.py:388:37: error: Argument 1 to "depart_emphasis" of "NodeVisitor" has incompatible type "Element"; expected "emphasis" [arg-type]
+ sphinx/writers/manpage.py:388:37: error: Argument 1 to "depart_emphasis" of "Translator" has incompatible type "Element"; expected "emphasis" [arg-type]
- sphinx/writers/manpage.py:391:34: error: Argument 1 to "visit_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/manpage.py:391:34: error: Argument 1 to "visit_strong" of "Translator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/manpage.py:394:35: error: Argument 1 to "depart_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/manpage.py:394:35: error: Argument 1 to "depart_strong" of "Translator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/manpage.py:403:34: error: Argument 1 to "visit_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/manpage.py:403:34: error: Argument 1 to "visit_strong" of "Translator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/manpage.py:406:35: error: Argument 1 to "depart_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/manpage.py:406:35: error: Argument 1 to "depart_strong" of "Translator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/manpage.py:416:35: error: Argument 1 to "visit_caption" of "NodeVisitor" has incompatible type "Element"; expected "caption" [arg-type]
+ sphinx/writers/manpage.py:416:35: error: Argument 1 to "visit_caption" of "Translator" has incompatible type "Element"; expected "caption" [arg-type]
- sphinx/writers/manpage.py:425:36: error: Argument 1 to "depart_caption" of "NodeVisitor" has incompatible type "Element"; expected "caption" [arg-type]
+ sphinx/writers/manpage.py:425:36: error: Argument 1 to "depart_caption" of "Translator" has incompatible type "Element"; expected "caption" [arg-type]
- sphinx/writers/manpage.py:439:36: error: Argument 1 to "visit_title" of "NodeVisitor" has incompatible type "Element"; expected "title" [arg-type]
+ sphinx/writers/manpage.py:439:36: error: Argument 1 to "visit_title" of "Translator" has incompatible type "Element"; expected "title" [arg-type]
- sphinx/writers/manpage.py:445:37: error: Argument 1 to "depart_title" of "NodeVisitor" has incompatible type "Element"; expected "title" [arg-type]
+ sphinx/writers/manpage.py:445:37: error: Argument 1 to "depart_title" of "Translator" has incompatible type "Element"; expected "title" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
sphinx (https://github.com/sphinx-doc/sphinx)
+ 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:350:57: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool" [arg-type]
- sphinx/writers/html5.py:361:31: error: Argument 1 to "depart_reference" of "NodeVisitor" has incompatible type "Element"; expected "reference" [arg-type]
+ sphinx/writers/html5.py:361:31: error: Argument 1 to "depart_reference" of "HTMLTranslator" has incompatible type "Element"; expected "reference" [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: comment, sub: Callable[[str, str], str] = ...) -> 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:458:35: error: Argument 1 to "visit_bullet_list" of "NodeVisitor" has incompatible type "Element"; expected "bullet_list" [arg-type]
+ sphinx/writers/html5.py:458:35: error: Argument 1 to "visit_bullet_list" of "HTMLTranslator" has incompatible type "Element"; expected "bullet_list" [arg-type]
- sphinx/writers/html5.py:521:33: error: Argument 1 to "visit_title" of "NodeVisitor" has incompatible type "Element"; expected "title" [arg-type]
+ sphinx/writers/html5.py:521:33: error: Argument 1 to "visit_title" of "HTMLTranslator" has incompatible type "Element"; expected "title" [arg-type]
- sphinx/writers/html5.py:562:30: error: Argument 1 to "depart_title" of "NodeVisitor" has incompatible type "Element"; expected "title" [arg-type]
+ sphinx/writers/html5.py:562:30: error: Argument 1 to "depart_title" of "HTMLTranslator" has incompatible type "Element"; expected "title" [arg-type]
- sphinx/writers/html5.py:592:48: error: Argument 1 to "visit_literal_block" of "NodeVisitor" has incompatible type "Element"; expected "literal_block" [arg-type]
+ sphinx/writers/html5.py:592:48: error: Argument 1 to "visit_literal_block" of "HTMLTranslator" has incompatible type "Element"; expected "literal_block" [arg-type]
- sphinx/writers/html5.py:624:35: error: Argument 1 to "visit_caption" of "NodeVisitor" has incompatible type "Element"; expected "caption" [arg-type]
+ sphinx/writers/html5.py:624:35: error: Argument 1 to "visit_caption" of "HTMLTranslator" has incompatible type "Element"; expected "caption" [arg-type]
- sphinx/writers/html5.py:648:36: error: Argument 1 to "depart_caption" of "NodeVisitor" has incompatible type "Element"; expected "caption" [arg-type]
+ sphinx/writers/html5.py:648:36: error: Argument 1 to "depart_caption" of "HTMLTranslator" has incompatible type "Element"; expected "caption" [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:747:37: error: Argument 1 to "visit_figure" of "NodeVisitor" has incompatible type "Element"; expected "figure" [arg-type]
+ sphinx/writers/html5.py:747:37: error: Argument 1 to "visit_figure" of "HTMLTranslator" has incompatible type "Element"; expected "figure" [arg-type]
- sphinx/writers/html5.py:775:29: error: Argument 1 to "visit_image" of "NodeVisitor" has incompatible type "Element"; expected "image" [arg-type]
+ sphinx/writers/html5.py:775:29: error: Argument 1 to "visit_image" of "HTMLTranslator" has incompatible type "Element"; expected "image" [arg-type]
- sphinx/writers/html5.py:782:34: error: Argument 1 to "depart_image" of "NodeVisitor" has incompatible type "Element"; expected "image" [arg-type]
+ sphinx/writers/html5.py:782:34: error: Argument 1 to "depart_image" of "HTMLTranslator" has incompatible type "Element"; expected "image" [arg-type]
- sphinx/writers/html5.py:896:36: error: Argument 1 to "visit_emphasis" of "NodeVisitor" has incompatible type "Element"; expected "emphasis" [arg-type]
+ sphinx/writers/html5.py:896:36: error: Argument 1 to "visit_emphasis" of "HTMLTranslator" has incompatible type "Element"; expected "emphasis" [arg-type]
- sphinx/writers/html5.py:899:37: error: Argument 1 to "depart_emphasis" of "NodeVisitor" has incompatible type "Element"; expected "emphasis" [arg-type]
+ sphinx/writers/html5.py:899:37: error: Argument 1 to "depart_emphasis" of "HTMLTranslator" has incompatible type "Element"; expected "emphasis" [arg-type]
- sphinx/writers/html5.py:902:34: error: Argument 1 to "visit_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/html5.py:902:34: error: Argument 1 to "visit_strong" of "HTMLTranslator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/html5.py:905:35: error: Argument 1 to "depart_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/html5.py:905:35: error: Argument 1 to "depart_strong" of "HTMLTranslator" has incompatible type "Element"; expected "strong" [arg-type]
+ 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/html5.py:941:30: error: Argument 1 to "depart_table" of "NodeVisitor" has incompatible type "Element"; expected "table" [arg-type]
+ sphinx/writers/html5.py:941:30: error: Argument 1 to "depart_table" of "HTMLTranslator" has incompatible type "Element"; expected "table" [arg-type]
- sphinx/writers/html5.py:954:41: error: Argument 1 to "visit_field_list" of "NodeVisitor" has incompatible type "Element"; expected "field_list" [arg-type]
+ sphinx/writers/html5.py:954:41: error: Argument 1 to "visit_field_list" of "HTMLTranslator" has incompatible type "Element"; expected "field_list" [arg-type]
- sphinx/writers/html5.py:958:42: error: Argument 1 to "depart_field_list" of "NodeVisitor" has incompatible type "Element"; expected "field_list" [arg-type]
+ sphinx/writers/html5.py:958:42: error: Argument 1 to "depart_field_list" of "HTMLTranslator" has incompatible type "Element"; expected "field_list" [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/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:32:9: error: Incompatible types in assignment (expression has type "NodeVisitor", variable has type "XMLTranslator") [assignment]
+ 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/writers/xml.py:37: error: Unused "type: ignore" comment [unused-ignore]
+ 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: note: At top level:
- sphinx/writers/manpage.py:134:36: error: Argument 1 to "visit_definition_list" of "NodeVisitor" has incompatible type "Element"; expected "definition_list" [arg-type]
+ sphinx/writers/manpage.py:134:36: error: Argument 1 to "visit_definition_list" of "Translator" has incompatible type "Element"; expected "definition_list" [arg-type]
- sphinx/writers/manpage.py:137:37: error: Argument 1 to "depart_definition_list" of "NodeVisitor" has incompatible type "Element"; expected "definition_list" [arg-type]
+ sphinx/writers/manpage.py:137:37: error: Argument 1 to "depart_definition_list" of "Translator" has incompatible type "Element"; expected "definition_list" [arg-type]
- sphinx/writers/manpage.py:140:41: error: Argument 1 to "visit_definition_list_item" of "NodeVisitor" has incompatible type "Element"; expected "definition_list_item" [arg-type]
+ sphinx/writers/manpage.py:140:41: error: Argument 1 to "visit_definition_list_item" of "Translator" has incompatible type "Element"; expected "definition_list_item" [arg-type]
- sphinx/writers/manpage.py:144:26: error: Argument 1 to "depart_term" of "NodeVisitor" has incompatible type "Element"; expected "term" [arg-type]
+ sphinx/writers/manpage.py:144:26: error: Argument 1 to "depart_term" of "Translator" has incompatible type "Element"; expected "term" [arg-type]
- sphinx/writers/manpage.py:153:31: error: Argument 1 to "visit_definition" of "NodeVisitor" has incompatible type "Element"; expected "definition" [arg-type]
+ sphinx/writers/manpage.py:153:31: error: Argument 1 to "visit_definition" of "Translator" has incompatible type "Element"; expected "definition" [arg-type]
- sphinx/writers/manpage.py:156:32: error: Argument 1 to "depart_definition" of "NodeVisitor" has incompatible type "Element"; expected "definition" [arg-type]
+ sphinx/writers/manpage.py:156:32: error: Argument 1 to "depart_definition" of "Translator" has incompatible type "Element"; expected "definition" [arg-type]
- sphinx/writers/manpage.py:235:30: error: Argument 1 to "visit_paragraph" of "NodeVisitor" has incompatible type "Element"; expected "paragraph" [arg-type]
+ sphinx/writers/manpage.py:235:30: error: Argument 1 to "visit_paragraph" of "Translator" has incompatible type "Element"; expected "paragraph" [arg-type]
- sphinx/writers/manpage.py:238:31: error: Argument 1 to "depart_paragraph" of "NodeVisitor" has incompatible type "Element"; expected "paragraph" [arg-type]
+ sphinx/writers/manpage.py:238:31: error: Argument 1 to "depart_paragraph" of "Translator" has incompatible type "Element"; expected "paragraph" [arg-type]
- sphinx/writers/manpage.py:245:32: error: Argument 1 to "visit_term" of "NodeVisitor" has incompatible type "Element"; expected "term" [arg-type]
+ sphinx/writers/manpage.py:245:32: error: Argument 1 to "visit_term" of "Translator" has incompatible type "Element"; expected "term" [arg-type]
- sphinx/writers/manpage.py:248:5: note: def visit_comment(self, node: comment, sub: _RegexPatternSub = ...) -> Never
+ sphinx/writers/manpage.py:248:5: note: def visit_comment(self, node: comment, sub: _RegexPatternSub = ...) -> None
- sphinx/writers/manpage.py:254:32: error: Argument 1 to "visit_footnote" of "NodeVisitor" has incompatible type "Element"; expected "footnote" [arg-type]
+ sphinx/writers/manpage.py:254:32: error: Argument 1 to "visit_footnote" of "Translator" has incompatible type "Element"; expected "footnote" [arg-type]
- sphinx/writers/manpage.py:271:32: error: Argument 1 to "depart_admonition" of "NodeVisitor" has incompatible type "Element"; expected "admonition" [arg-type]
+ sphinx/writers/manpage.py:271:32: error: Argument 1 to "depart_admonition" of "Translator" has incompatible type "Element"; expected "admonition" [arg-type]
- sphinx/writers/manpage.py:304:25: error: Argument 1 to "visit_Text" of "NodeVisitor" has incompatible type "Element"; expected "Text" [arg-type]
+ sphinx/writers/manpage.py:304:25: error: Argument 1 to "visit_Text" of "Translator" has incompatible type "Element"; expected "Text" [arg-type]
- sphinx/writers/manpage.py:373:32: error: Argument 1 to "visit_bullet_list" of "NodeVisitor" has incompatible type "Element"; expected "bullet_list" [arg-type]
+ sphinx/writers/manpage.py:373:32: error: Argument 1 to "visit_bullet_list" of "Translator" has incompatible type "Element"; expected "bullet_list" [arg-type]
- sphinx/writers/manpage.py:376:33: error: Argument 1 to "depart_bullet_list" of "NodeVisitor" has incompatible type "Element"; expected "bullet_list" [arg-type]
+ sphinx/writers/manpage.py:376:33: error: Argument 1 to "depart_bullet_list" of "Translator" has incompatible type "Element"; expected "bullet_list" [arg-type]
- sphinx/writers/manpage.py:385:36: error: Argument 1 to "visit_emphasis" of "NodeVisitor" has incompatible type "Element"; expected "emphasis" [arg-type]
+ sphinx/writers/manpage.py:385:36: error: Argument 1 to "visit_emphasis" of "Translator" has incompatible type "Element"; expected "emphasis" [arg-type]
- sphinx/writers/manpage.py:388:37: error: Argument 1 to "depart_emphasis" of "NodeVisitor" has incompatible type "Element"; expected "emphasis" [arg-type]
+ sphinx/writers/manpage.py:388:37: error: Argument 1 to "depart_emphasis" of "Translator" has incompatible type "Element"; expected "emphasis" [arg-type]
- sphinx/writers/manpage.py:391:34: error: Argument 1 to "visit_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/manpage.py:391:34: error: Argument 1 to "visit_strong" of "Translator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/manpage.py:394:35: error: Argument 1 to "depart_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/manpage.py:394:35: error: Argument 1 to "depart_strong" of "Translator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/manpage.py:403:34: error: Argument 1 to "visit_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/manpage.py:403:34: error: Argument 1 to "visit_strong" of "Translator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/manpage.py:406:35: error: Argument 1 to "depart_strong" of "NodeVisitor" has incompatible type "Element"; expected "strong" [arg-type]
+ sphinx/writers/manpage.py:406:35: error: Argument 1 to "depart_strong" of "Translator" has incompatible type "Element"; expected "strong" [arg-type]
- sphinx/writers/manpage.py:416:35: error: Argument 1 to "visit_caption" of "NodeVisitor" has incompatible type "Element"; expected "caption" [arg-type]
+ sphinx/writers/manpage.py:416:35: error: Argument 1 to "visit_caption" of "Translator" has incompatible type "Element"; expected "caption" [arg-type]
- sphinx/writers/manpage.py:425:36: error: Argument 1 to "depart_caption" of "NodeVisitor" has incompatible type "Element"; expected "caption" [arg-type]
+ sphinx/writers/manpage.py:425:36: error: Argument 1 to "depart_caption" of "Translator" has incompatible type "Element"; expected "caption" [arg-type]
- sphinx/writers/manpage.py:439:36: error: Argument 1 to "visit_title" of "NodeVisitor" has incompatible type "Element"; expected "title" [arg-type]
+ sphinx/writers/manpage.py:439:36: error: Argument 1 to "visit_title" of "Translator" has incompatible type "Element"; expected "title" [arg-type]
- sphinx/writers/manpage.py:445:37: error: Argument 1 to "depart_title" of "NodeVisitor" has incompatible type "Element"; expected "title" [arg-type]
+ sphinx/writers/manpage.py:445:37: error: Argument 1 to "depart_title" of "Translator" has incompatible type "Element"; expected "title" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
sphinx (https://github.com/sphinx-doc/sphinx)
+ 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: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: comment, sub: Callable[[str, str], str] = ...) -> 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_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/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:32:9: error: Incompatible types in assignment (expression has type "NodeVisitor", variable has type "XMLTranslator") [assignment]
+ 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/writers/xml.py:37: error: Unused "type: ignore" comment [unused-ignore]
+ 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:28: error: Unused "type: ignore" comment [unused-ignore]
+ sphinx/writers/manpage.py: note: In member "translate" of class "ManualPageWriter":
+ sphinx/writers/manpage.py:34:43: error: Argument 1 to "NestedInlineTransform" has incompatible type "document | None"; expected "document" [arg-type]
+ sphinx/writers/manpage.py:38:9: error: Item "None" of "document | None" has no attribute "walkabout" [union-attr]
+ sphinx/builders/xml.py: note: In member "_translate" of class "XMLBuilder":
+ sphinx/builders/xml.py:90:34: error: Incompatible types in assignment (expression has type "NodeVisitor", variable has type "XMLTranslator") [assignment]
See my comment about visit methods in #14234: We should probably just add them to NodeVisitor with standard types and leave them alone in sub-classes (unless those sub-classes do anything fancy with them).
See my comment about visit methods in #14234: We should probably just add them to
NodeVisitorwith standard types and leave them alone in sub-classes (unless those sub-classes do anything fancy with them).
Judging by mypy primer output, there is only one mismatched override visit method - visit_comment, and there is a comment about it (sphinx source code comment)
Diff from mypy_primer, showing the effect of this PR on open source code:
sphinx (https://github.com/sphinx-doc/sphinx)
+ 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: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: comment, sub: Callable[[str, str], str] = ...) -> 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_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/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:32:9: error: Incompatible types in assignment (expression has type "NodeVisitor", variable has type "XMLTranslator") [assignment]
+ 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/writers/xml.py:37: error: Unused "type: ignore" comment [unused-ignore]
+ 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:28: error: Unused "type: ignore" comment [unused-ignore]
+ sphinx/writers/manpage.py: note: In member "translate" of class "ManualPageWriter":
+ sphinx/writers/manpage.py:34:43: error: Argument 1 to "NestedInlineTransform" has incompatible type "document | None"; expected "document" [arg-type]
+ sphinx/writers/manpage.py:38:9: error: Item "None" of "document | None" has no attribute "walkabout" [union-attr]
+ sphinx/builders/xml.py: note: In member "_translate" of class "XMLBuilder":
+ sphinx/builders/xml.py:90:34: error: Incompatible types in assignment (expression has type "NodeVisitor", variable has type "XMLTranslator") [assignment]
sphinx/writers/html5.py:350:57: error: Argument 4 to "starttag" of "HTMLTranslator" has incompatible type "**dict[str, str]"; expected "bool" [arg-type]
This is a weird semi-false positive. starttag – matching the implementation – is now:
def starttag(self, node: nodes.Element, tagname: str, suffix: str = "\n", empty: bool = False, **attributes) -> str: ...
This is called with self.starttag(node, 'a', '', **atts), where atts is dict[str, str]. I assume that mypy is not liking that in theory atts could contain empty: "foo", which would conflict with starttag. I don't think there's much we can do, though.
Overall the primer hits all seem in the category "nothing we can do about".
This is a weird semi-false positive.
starttag– matching the implementation – is now:
I noticed this too and wrote an example when mypy complains:
from typing import Any
def test(v: bool = True, **kwargs: Any) -> None:
print(f"{v=}")
print(f"{kwargs=}")
if __name__ == "__main__":
kwargs = {"a": 4, "b": "a", "c": None}
test(**kwargs)
And result:
~ uv run main.py
v=True
kwargs={'a': 4, 'b': 'a', 'c': None}
~ uv run mypy main.py
main.py:9: error: Argument 1 to "test" has incompatible type "**dict[str, object]"; expected "bool" [arg-type]
Found 1 error in 1 file (checked 1 source file)
But the interesting thing is that if you explicitly specify that kwargs is a dict (at least kwargs: dict = ...), then mypy won't complain