-
Notifications
You must be signed in to change notification settings - Fork 107
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
B022: No arguments passed to contextlib.suppress #231
Conversation
You're to quick - Sorry - I just merged another PR. I can look at cleaning up here or if you beat me that would be awesome too :D |
hehe no worries, I've resolved them now 😄 Would be good to get your take on this PR currently only covering |
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.
All makes sense to me, and test show us working and handling *
expansion which is good.
Ahhh, I didn't think of this. Yeah, I feel assuming with |
Yeah that was my thinking too, better to avoid false positives 😄 Maybe we initially keep the rule like this and then I can make a separate issue to find a way to track variable/function scope when traversing the AST as a future refinement (I think pyflakes has something similar for tracking if imports get used). |
Closes #222.
This covers the case where
contextlib.suppress
is usedHowever, it does not currently cover the case where
suppress
is imported fromcontextlib
Do you know of any existing flake8 helper functions/methods to tie the
suppress
function node to it's import?I don't want to just ignore the one word
suppress
without checking incase it's actually a user defined function.