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
EHN: also raise B006 for list/dict/set comprehensions #186
EHN: also raise B006 for list/dict/set comprehensions #186
Conversation
oh bloody hell, there's AST differences on Python 3.7 and below >.< |
bugbear.py
Outdated
@@ -653,6 +655,7 @@ def visit(self, node): | |||
) | |||
) | |||
B006.mutable_literals = (ast.Dict, ast.List, ast.Set) | |||
B006.mutable_comprehensions = (ast.ListComp, ast.DictComp) |
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 think set comprehensions ({x for x in y}
) is also suitable in this context
B006.mutable_comprehensions = (ast.ListComp, ast.DictComp) | |
B006.mutable_comprehensions = (ast.ListComp, ast.DictComp, ast.SetComp) |
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.
And I knew I was forgetting something, thanks for noticing I'll fix it soon once I get back to my computer at home.
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.
LGTM - Thanks Mr @ichard26 :D
@@ -103,6 +103,8 @@ def test_b006_b008(self): | |||
B006(70, 32), | |||
B008(98, 29), | |||
B008(102, 44), | |||
B006(124, 45 if sys.version_info >= (3, 8) else 46), |
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.
Yeah, I agree lets only care for newer versions ...
Fixes GH-184.