-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make flake8 xarray
pass
#1824
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
Make flake8 xarray
pass
#1824
Conversation
536b48f
to
9c9a72e
Compare
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.
Thanks!
Please fix the test failure, then I'll merge this promptly so it doesn't fall out of date :).
xarray/tests/test_backends.py
Outdated
print(ds2.randovar.values) # should raise IndexError in netCDF4 | ||
except IndexError as err: | ||
self.assertIn('first by calling .load', str(err)) | ||
with pytest.raises(IndexError) as err: |
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.
This modified test is failing in Travis. I think we actually want to keep something similar to what we had before. The idea was that netcdf4 was raising an error that we wanted to be sure we were reraising with a better error message. NetCDF4 stopped raising the error in recent versions,so we can silently ignore this behavior if a newer version of netcdf4 is installed.
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.
Makes sense - I'll improve the comment instead 😆
@@ -27,7 +27,7 @@ def set_to_zero(self, x, i): | |||
def test_expanded_indexer(self): | |||
x = np.random.randn(10, 11, 12, 13, 14) | |||
y = np.arange(5) | |||
I = ReturnItem() | |||
I = ReturnItem() # noqa: E741 # allow ambiguous name |
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.
These meaningless noqa numbers are one reason why I like pylint over flake8 sometimes...
@shoyer; done 🎉 |
Thanks! |
Closes #1741 by @mrocklin (who did most of the work I'm presenting here). I had an evening free, so I rebased the previous pull on master, fixed the conflicts, and then made everything pass with
flake8
's default settings (including line length). My condolences to whoever gets to review this diff!The single change any non-pedant will notice: Travis now fails if there is a flake8 warning anywhere. My experience in other projects is that this is the only way to actually keep flake8 passing - it's just unrealistic to expect perfect attention to detail from every contributor, but "make the build green before we merge" is widely understood 😄