typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

add type annotations to docutils.writers

Open danieleades opened this issue 1 year ago • 5 comments

danieleades avatar Jul 24 '24 19:07 danieleades

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

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/io.py:146: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/io.py:146:25: error: Missing type parameters for generic type "UnfilteredWriter"  [type-arg]
+ sphinx/io.py:146:25: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/latex.py:69: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/latex.py:69:19: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/latex.py:69:19: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/latex.py: note: In class "LaTeXWriter":
+ sphinx/writers/latex.py:78:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/latex.py: note: In member "translate" of class "LaTeXWriter":
+ sphinx/writers/latex.py:88:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/builders/latex/__init__.py: note: In member "write" of class "LaTeXBuilder":
+ sphinx/builders/latex/__init__.py:281:28: error: Argument "components" to "OptionParser" has incompatible type "tuple[LaTeXWriter]"; expected "Iterable[type[Parser]]"  [arg-type]
+ sphinx/builders/html/__init__.py: note: In member "__init__" of class "StandaloneHTMLBuilder":
+ sphinx/builders/html/__init__.py:213:17: error: Type argument "DocTreeInput" of "Reader" must be a subtype of "str | bytes"  [type-var]
+ sphinx/writers/text.py:359: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/text.py:359:18: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/text.py:359:18: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/text.py: note: In class "TextWriter":
+ sphinx/writers/text.py:362:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/text.py: note: In member "translate" of class "TextWriter":
+ sphinx/writers/text.py:372:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/builders/text.py: note: In member "write_doc" of class "TextBuilder":
+ sphinx/builders/text.py:74:27: error: Argument 1 to "write" of "Writer" has incompatible type "Node"; expected "document"  [arg-type]
+ sphinx/writers/texinfo.py:108: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/texinfo.py:108:21: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/texinfo.py:108:21: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/texinfo.py: note: In class "TexinfoWriter":
+ sphinx/writers/texinfo.py:113:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/texinfo.py:121:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/texinfo.py: note: In member "translate" of class "TexinfoWriter":
+ sphinx/writers/texinfo.py:134:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/builders/texinfo.py: note: In member "write" of class "TexinfoBuilder":
+ sphinx/builders/texinfo.py:120:36: error: Argument "components" to "OptionParser" has incompatible type "tuple[TexinfoWriter]"; expected "Iterable[type[Parser]]"  [arg-type]

github-actions[bot] avatar Jul 24 '24 19:07 github-actions[bot]

there's definitely there's definitely some issues with these stubs.

@jayaddison @picnixz

can i get your insight?

danieleades avatar Jul 26 '24 12:07 danieleades

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

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/io.py:146: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/io.py:146:25: error: Missing type parameters for generic type "UnfilteredWriter"  [type-arg]
+ sphinx/io.py:146:25: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/latex.py:69: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/latex.py:69:19: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/latex.py:69:19: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/latex.py: note: In class "LaTeXWriter":
+ sphinx/writers/latex.py:78:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/latex.py: note: In member "translate" of class "LaTeXWriter":
+ sphinx/writers/latex.py:88:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/writers/text.py:359: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/text.py:359:18: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/text.py:359:18: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/text.py: note: In class "TextWriter":
+ sphinx/writers/text.py:362:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/text.py: note: In member "translate" of class "TextWriter":
+ sphinx/writers/text.py:372:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/builders/text.py: note: In member "write_doc" of class "TextBuilder":
+ sphinx/builders/text.py:74:27: error: Argument 1 to "write" of "Writer" has incompatible type "Node"; expected "document"  [arg-type]
+ sphinx/writers/texinfo.py:108: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/texinfo.py:108:21: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/texinfo.py:108:21: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/texinfo.py: note: In class "TexinfoWriter":
+ sphinx/writers/texinfo.py:113:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/texinfo.py:121:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/texinfo.py: note: In member "translate" of class "TexinfoWriter":
+ sphinx/writers/texinfo.py:134:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]

github-actions[bot] avatar Jul 27 '24 11:07 github-actions[bot]

The only relevant error is now:

Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable

and

  • sphinx/builders/text.py:74:27: error: Argument 1 to "write" of "Writer" has incompatible type "Node"; expected "document" [arg-type]

picnixz avatar Jul 27 '24 11:07 picnixz

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

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/io.py:146: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/io.py:146:25: error: Missing type parameters for generic type "UnfilteredWriter"  [type-arg]
+ sphinx/io.py:146:25: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/latex.py:69: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/latex.py:69:19: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/latex.py:69:19: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/latex.py: note: In class "LaTeXWriter":
+ sphinx/writers/latex.py:78:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/latex.py: note: In member "translate" of class "LaTeXWriter":
+ sphinx/writers/latex.py:88:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/writers/text.py:359: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/text.py:359:18: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/text.py:359:18: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/text.py: note: In class "TextWriter":
+ sphinx/writers/text.py:362:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/text.py: note: In member "translate" of class "TextWriter":
+ sphinx/writers/text.py:372:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/builders/text.py: note: In member "write_doc" of class "TextBuilder":
+ sphinx/builders/text.py:74:27: error: Argument 1 to "write" of "Writer" has incompatible type "Node"; expected "document"  [arg-type]
+ sphinx/writers/texinfo.py:108: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/texinfo.py:108:21: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/texinfo.py:108:21: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/texinfo.py: note: In class "TexinfoWriter":
+ sphinx/writers/texinfo.py:113:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/texinfo.py:121:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/texinfo.py: note: In member "translate" of class "TexinfoWriter":
+ sphinx/writers/texinfo.py:134:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]

github-actions[bot] avatar Jul 27 '24 12:07 github-actions[bot]

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

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/io.py:146: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/io.py:146:25: error: Missing type parameters for generic type "UnfilteredWriter"  [type-arg]
+ sphinx/io.py:146:25: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/latex.py:68: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/latex.py:68:19: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/latex.py:68:19: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/latex.py: note: In class "LaTeXWriter":
+ sphinx/writers/latex.py:77:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/latex.py: note: In member "translate" of class "LaTeXWriter":
+ sphinx/writers/latex.py:87:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/writers/text.py:359: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/text.py:359:18: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/text.py:359:18: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/text.py: note: In class "TextWriter":
+ sphinx/writers/text.py:362:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/text.py: note: In member "translate" of class "TextWriter":
+ sphinx/writers/text.py:372:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]
+ sphinx/writers/texinfo.py:107: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/texinfo.py:107:21: error: Missing type parameters for generic type "Writer"  [type-arg]
+ sphinx/writers/texinfo.py:107:21: note: Error code "type-arg" not covered by "type: ignore" comment
+ sphinx/writers/texinfo.py: note: In class "TexinfoWriter":
+ sphinx/writers/texinfo.py:112:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/texinfo.py:120:5: error: Cannot override class variable (previously declared on base class "SettingsSpec") with instance variable  [misc]
+ sphinx/writers/texinfo.py: note: In member "translate" of class "TexinfoWriter":
+ sphinx/writers/texinfo.py:133:9: error: Item "None" of "document | None" has no attribute "walkabout"  [union-attr]

github-actions[bot] avatar Oct 03 '24 02:10 github-actions[bot]