Skip to content
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

Add test and docs for top level mypy: disable-error-code comment #14810

Merged
merged 3 commits into from
Mar 1, 2023

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Mar 1, 2023

I went with the smallest change possible.
@xitop, please, take a look. Does it make sense to you? :)

Closes #14750

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, could you also update the error message here:

"use `# mypy: disable-error-code=...`"

@xitop
Copy link

xitop commented Mar 1, 2023

I went with the smallest change possible. @xitop, please, take a look. Does it make sense to you? :)

Yes, looks fine. Thank you for your work. But regarding the typing and using mypy I'm a beginner, so don't count on my opinion too much.

@sobolevn
Copy link
Member Author

sobolevn commented Mar 1, 2023

@xitop beginners provide the best feedback for the docs! Thank you for the report 👍

@sobolevn
Copy link
Member Author

sobolevn commented Mar 1, 2023

@hauntsaninja we now have smart error message, thanks for the suggestion :)

@@ -487,11 +487,12 @@ def translate_stmt_list(
and self.type_ignores
and min(self.type_ignores) < self.get_lineno(stmts[0])
):
if self.type_ignores[min(self.type_ignores)]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use walrus just yet; we still support 3.7

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first time I've used walrus in real code :)
Probably, the last time.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2023

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@hauntsaninja hauntsaninja merged commit c245e91 into master Mar 1, 2023
@hauntsaninja hauntsaninja deleted the issue-14750 branch March 1, 2023 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

# mypy: disable-error-code=... usage details not documented
3 participants