typeshed
typeshed copied to clipboard
address some more type errors
based on findings in https://github.com/sphinx-doc/sphinx/pull/13634
should be retested after that PR is merged
Diff from mypy_primer, showing the effect of this PR on open source code:
sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/__init__.py: note: In member "apply" of class "SphinxSmartQuotes":
- sphinx/transforms/__init__.py:373:9: error: Cannot assign to class variable "smartquotes_action" via instance [misc]
+ sphinx/util/rst.py:69: error: Unused "type: ignore" comment [unused-ignore]
- sphinx/util/docutils.py:469:16: error: Call to untyped function "write" in typed context [no-untyped-call]
+ sphinx/util/docutils.py:455:5: error: Signature of "write" incompatible with supertype "docutils.io.FileOutput" [override]
+ sphinx/util/docutils.py:455:5: note: Superclass:
+ sphinx/util/docutils.py:455:5: note: @overload
+ sphinx/util/docutils.py:455:5: note: def write(self, data: str) -> str | bytes
+ sphinx/util/docutils.py:455:5: note: @overload
+ sphinx/util/docutils.py:455:5: note: def write(self, data: bytes) -> bytes
+ sphinx/util/docutils.py:455:5: note: Subclass:
+ sphinx/util/docutils.py:455:5: note: def write(self, data: str) -> str
+ sphinx/util/docutils.py:469:16: error: Incompatible return value type (got "str | bytes", expected "str") [return-value]
- sphinx/directives/__init__.py: note: In member "run" of class "DefaultRole":
- sphinx/directives/__init__.py:329:24: error: Argument 2 to "role" has incompatible type "_RstLanguageModule"; expected "_LanguageModule" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/transforms/__init__.py: note: In class "SphinxSmartQuotes":
+ sphinx/transforms/__init__.py:368:5: error: Cannot override instance variable (previously declared on base class "SmartQuotes") with class variable [misc]
+ sphinx/util/rst.py:69: error: Unused "type: ignore" comment [unused-ignore]
+ sphinx/util/docutils.py: note: In member "write" of class "SphinxFileOutput":
+ sphinx/util/docutils.py:456:5: error: Signature of "write" incompatible with supertype "docutils.io.FileOutput" [override]
+ sphinx/util/docutils.py:456:5: note: Superclass:
+ sphinx/util/docutils.py:456:5: note: @overload
+ sphinx/util/docutils.py:456:5: note: def write(self, data: str) -> str | bytes
+ sphinx/util/docutils.py:456:5: note: @overload
+ sphinx/util/docutils.py:456:5: note: def write(self, data: bytes) -> bytes
+ sphinx/util/docutils.py:456:5: note: Subclass:
+ sphinx/util/docutils.py:456:5: note: def write(self, data: str) -> str
+ sphinx/util/docutils.py: note: At top level:
+ sphinx/util/docutils.py:472: error: Unused "type: ignore" comment [unused-ignore]
+ sphinx/util/docutils.py: note: In member "write" of class "SphinxFileOutput":
+ sphinx/util/docutils.py:472:16: error: Incompatible return value type (got "str | bytes", expected "str") [return-value]
+ sphinx/util/docutils.py:472:16: note: Error code "return-value" not covered by "type: ignore" comment
+ sphinx/directives/__init__.py:333: error: Unused "type: ignore" comment [unused-ignore]