-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
improve type annotations in 'docutils.statemachine' #11469
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
55abe87
to
0212302
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5807abb
to
e5e9b29
Compare
@srittau I could really use your eyes on this one! I think i've made good progress, but could use some assistance to get this over the line, if you have the time |
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
9b689d8
to
e99408a
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
That looks right, but you should use the alias as |
32a7df9
to
6d80003
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
This probably has something to do with the other errors. |
f8eea52
to
1a308ad
Compare
This comment has been minimized.
This comment has been minimized.
@JelleZijlstra anything else needed to get this one merged? (it's blocking a couple of other PRs) |
Co-authored-by: Sebastian Rittau <[email protected]>
827d321
to
b8897e9
Compare
Diff from mypy_primer, showing the effect of this PR on open source code: sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/docutils.py: note: In function "switch_source_input":
+ sphinx/util/docutils.py:386:25: error: Need type annotation for "state_machine" [var-annotated]
+ sphinx/util/docutils.py:386:25: note: Error code "var-annotated" not covered by "type: ignore" comment
- sphinx/util/docutils.py: note: At top level:
- sphinx/util/docutils.py:383: error: Unused "type: ignore" comment [unused-ignore]
- sphinx/util/docutils.py:386: error: Unused "type: ignore" comment [unused-ignore]
- sphinx/util/docutils.py:388: error: Unused "type: ignore" comment [unused-ignore]
- sphinx/util/docutils.py:393: error: Unused "type: ignore" comment [unused-ignore]
+ sphinx/util/rst.py: note: In function "append_epilog":
+ sphinx/util/rst.py:109:36: error: Unsupported operand types for + ("None" and "int") [operator]
+ sphinx/util/rst.py:109:36: note: Left operand is of type "Optional[int]"
- sphinx/parsers.py:64: error: Unused "type: ignore" comment [unused-ignore]
|
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 spotted one thing. But looks good to go apart from that.
Diff from mypy_primer, showing the effect of this PR on open source code: sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/docutils.py: note: In function "switch_source_input":
+ sphinx/util/docutils.py:386:25: error: Need type annotation for "state_machine" [var-annotated]
+ sphinx/util/docutils.py:386:25: note: Error code "var-annotated" not covered by "type: ignore" comment
- sphinx/util/docutils.py: note: At top level:
- sphinx/util/docutils.py:383: error: Unused "type: ignore" comment [unused-ignore]
- sphinx/util/docutils.py:386: error: Unused "type: ignore" comment [unused-ignore]
- sphinx/util/docutils.py:388: error: Unused "type: ignore" comment [unused-ignore]
- sphinx/util/docutils.py:393: error: Unused "type: ignore" comment [unused-ignore]
+ sphinx/util/rst.py: note: In function "append_epilog":
+ sphinx/util/rst.py:109:36: error: Unsupported operand types for + ("None" and "int") [operator]
+ sphinx/util/rst.py:109:36: note: Left operand is of type "Optional[int]"
- sphinx/parsers.py:64: error: Unused "type: ignore" comment [unused-ignore]
|
adds type annotations for docutils.statemachine.
I'm not super confident about the use of the generic
_Context
for the state machine since the only code examples I can find using this class are in thesphinx
repo, and there no context is used (ever).