Skip to content

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

Merged
merged 7 commits into from
Jan 14, 2018
Merged

Make flake8 xarray pass #1824

merged 7 commits into from
Jan 14, 2018

Conversation

Zac-HD
Copy link
Contributor

@Zac-HD Zac-HD commented Jan 13, 2018

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 😄

mrocklin and others added 6 commits January 13, 2018 19:11
autoflake --in-place xarray/*.py xarray/*/*.py
autopep8 --in-place --max-line-length 120 --global-config setup.cfg xarray/*.py xarray/*/*.py
@Zac-HD Zac-HD force-pushed the auto-flake branch 2 times, most recently from 536b48f to 9c9a72e Compare January 13, 2018 12:06
@mrocklin
Copy link
Contributor

mrocklin commented Jan 13, 2018 via email

Copy link
Member

@shoyer shoyer left a 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 :).

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:
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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...

@Zac-HD
Copy link
Contributor Author

Zac-HD commented Jan 14, 2018

@shoyer; done 🎉

@shoyer shoyer merged commit 0d69bf9 into pydata:master Jan 14, 2018
@shoyer
Copy link
Member

shoyer commented Jan 14, 2018

Thanks!

@Zac-HD Zac-HD deleted the auto-flake branch January 14, 2018 23:10
@Zac-HD Zac-HD mentioned this pull request Feb 28, 2018
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants