-
Notifications
You must be signed in to change notification settings - Fork 2
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
BUG: Regex should be more complete/selective #1
Comments
I'd start with readability... ARRAY_LIKE_REGEX = re.compile(r'''(?x)
[\[(]
[0-9 ij,+\-*^\/&|\[\]]*
[\]),;]
''') I'm surprised Does this need to operate line-by-line, or can we match a multi-line expression? That way you could better require being in While I do think that these formats can be aesthetically better in tests etc, we are likely moving to black at Scikit-learn, so neither my nor flake8's opinion on style matters any longer! |
Just didn't think of these...
It operates on a "logical line", so yes it's a single complete expression with no newlines. |
It should be more selective (matching
[
and maybe ensuring anyi/j
are immediately preceded by numbers, currently it's pretty basic:@jnothman I know you work on sklearn, @agramfort mentioned this might be useful for you all, too. Any interest in improving the regex here, and maybe adopting this for sklearn?
Basically this plugin will replace
E
error variants:With
A2XX
versions, where the ones above are ignored if they occur within an array-like list of (list of) numerical values. So you basically run an equivalent offlake8 --ignore E201,E202,E203,E221,E222,E241 --select=A
and it should work. This came up originally for scipy (WIP PR to add this plugin here) but I imagine you all might have been annoyed about this at some point, too, so wanted to loop you in.The text was updated successfully, but these errors were encountered: