MAINT: Start applying ruff/Pycodestyle rules#26857
Conversation
55c9ba4 to
82f20e1
Compare
7cecfd0 to
da91eaf
Compare
91381ad to
b669241
Compare
b669241 to
d8b8d95
Compare
d8b8d95 to
d22d7d9
Compare
rkern
left a comment
There was a problem hiding this comment.
I haven't individually confirmed all of the import removals, but I did note the ones that had a comment explaining why they were there and should not be removed.
I think the other changes look good to my eyeballs.
f6c9e96 to
1fea2d3
Compare
| assert(np.isnan(div)), "div: %s" % div | ||
| div = np.floor_divide(fnan, fzer) | ||
| assert(np.isnan(div)), "dt: %s, div: %s" % (dt, div) | ||
| assert(np.isnan(div)), "div: %s" % div |
There was a problem hiding this comment.
Is there a reason to not remove the parentheses from the asserts?
| assert(np.isnan(div)), "div: %s" % div | |
| assert np.isnan(div), "div: %s" % div |
There was a problem hiding this comment.
These commits contain automated fixes when possible. I try not to manually modify these fixes, unless really needed. There's a ruff/pyupgrade rule for extraneous parentheses (UP034), which I could apply in a different PR.
mattip
left a comment
There was a problem hiding this comment.
We usually do not like these kinds of code reformats, but this one is actually quite nice. I thing we shouldn't be touching the deprecated numpy.distutils, could you revert those?
| @@ -1,3 +1,4 @@ | |||
| import os | |||
There was a problem hiding this comment.
Perhaps resolve_includes() is usually not called.
There was a problem hiding this comment.
We usually do not like these kinds of code reformats, but this one is actually quite nice.
This is not really a "reformat", rather in support of migrating linting from Pycodestyle to ruff (#24994).
There was a problem hiding this comment.
I thing we shouldn't be touching the deprecated numpy.distutils, could you revert those?
Done.
Actually, numpy.distutils had already been touched. Should I revert prior linting changes?
https://github.com/numpy/numpy/commits/main/numpy/distutils
| assert_isin_equal(empty_array, empty_array) | ||
|
|
||
| @pytest.mark.parametrize("kind", [None, "sort", "table"]) | ||
| def test_isin(self, kind): |
There was a problem hiding this comment.
Rather than remove this, please rename the tests and keep them separate.
There was a problem hiding this comment.
We have two test functions with the same name and identical parameters:
numpy/numpy/lib/tests/test_arraysetops.py
Lines 214 to 215 in eb6ac83
numpy/numpy/lib/tests/test_arraysetops.py
Lines 272 to 273 in eb6ac83
I think it makes sense to merge, doesn't it?
There was a problem hiding this comment.
I renamed the second test_isin to test_isin_additional.
| nsteps = None | ||
|
|
||
| source = scrub_source(source, nsteps, verbose=True) | ||
| source = scrubSource(source, nsteps, verbose=True) |
There was a problem hiding this comment.
I guess this Python 2.7 script hasn't been used for a long time - probably not after f589305 in 2018.
d9419f1 to
2d05f15
Compare
21eaf4e to
f30b9e8
Compare
|
Needs rebase. |
f30b9e8 to
5922427
Compare
F401 imported but unused I have left out *.pyi files. Still lots of occurrences to examine. Co-authored-by: Robert Kern <[email protected]>
F541 f-string without any placeholders
F811 Redefinition of unused `...` I have left out *.pyi files and some special cases.
F821 Undefined name I have left out *.pyi files and some special cases.
E401 Multiple imports on one line
E701 Multiple statements on one line (colon)
E711 Comparison to `None` should be `cond is None`
E712 Avoid inequality comparisons to `True`; use `if not cond:` for false checks
E713 Test for membership should be `not in`
E714 Test for object identity should be `is not`
E722 Do not use bare `except`
Co-authored-by: Robert Kern <[email protected]>
3a48cc5 to
694b862
Compare
|
Thanks @DimitriPapadopoulos . |
Start working on #24994.
I have left out most of
distutils,*.pyifiles, and some special cases that seem to require extra attention.