Skip to content

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

Merged
hauntsaninja merged 3 commits intomasterfrom
issue-14750
Mar 1, 2023
Merged

Add test and docs for top level mypy: disable-error-code comment#14810
hauntsaninja merged 3 commits intomasterfrom
issue-14750

Conversation

@sobolevn
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Member Author

sobolevn commented Mar 1, 2023

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

@sobolevn
Copy link
Copy Markdown
Member Author

sobolevn commented Mar 1, 2023

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

Comment thread mypy/fastparse.py
and self.type_ignores
and min(self.type_ignores) < self.get_lineno(stmts[0])
):
if self.type_ignores[min(self.type_ignores)]:
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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