-
Notifications
You must be signed in to change notification settings - Fork 748
Fix false-positive E211 with match and case #989
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
pycodestyle.py
Outdated
| # Allow "return (a.foo for a in range(5))" | ||
| not keyword.iskeyword(prev_text) and | ||
| # 'match' and 'case' are only soft keywords | ||
| prev_text not in ('match', 'case') |
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.
perhaps sys.version_info >= (3, 9) and not keyword.issoftkeyword(prev_text) (err, might need some boolean flipping, but you get the idea)
https://docs.python.org/3.10/library/keyword.html#keyword.issoftkeyword
testsuite/python310.py
Outdated
| #: Okay | ||
| case (1, 2): | ||
| pass | ||
| #: Okay |
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.
the #: is supposed to split separate cases -- you shouldn't need anything except the first comment (also please include the var1, var2 in the example)
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.
👌🏻 Didn't know that. Is there a way to run the test case only for Python 3.10+? Especially with the first change you suggested, the tests will fail without it.
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.
the file naming is supposed to handle that, but it looks like this needs to have a + added to the second digit group here:
pycodestyle/testsuite/support.py
Line 172 in c4460cb
| ver_match = re.search(r'python(\d)(\d)?\.py$', filename) |
asottile
left a comment
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.
|
Should I add 3.10 to Github CI action as well? |
yeah that would be good! thanks |
Done. All tests passed 🚀 |
|
Hi there! @asottile Do you plan to make a release with bug fixes for pattern matching support (this one in particular) before Python 3.10 comes out? |
|
please don't ask for releases, they will happen when they happen these are not bugfixes, this is a feature and it is not complete (there are still issues with |

Fix false-positive
E211 whitespace before '('formatchandcase, Python 3.10