-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Make flake8 exceptions explicit #11613
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
PS, while this may seem like a long list, there are only 190 of 565, ~33% of the files matched by the glob that actually require the exception. |
OK, as a counterexample Do we
I'd vote for 3, but this PR precludes that. #############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions and methods is shown in this example:
import matplotlib
matplotlib.axes.Axes.inset_axes_from_bounds
matplotlib.axes.Axes.indicate_inset_zoom
matplotlib.axes.Axes.imshow |
I am inclined to skip checking E402 everywhere (which will greatly reduce this list). |
OK. Done at #11621 |
Or instead of exceptions, add |
The problem is that sphinx-gallery has no way to drill down the axes stack for us because of how we've structured it. ping @ImportanceOfBeingErnest @timhoffm @fredrik-1 who seem to understand sphinx-gallery quite well. But the above was the soln we came to. I'm not horribly opposed to |
I guess one could in some (yet to be determined way) hack into sphinx gallery and let it produce all examples with I would personally vote for skipping the import checks for the examples. Even without the issue of the Reference sections, there are probably enough cases where some import should only occur late in the example. A global ignore for the examples (and tutorials) folder would make the list significantly shorter and prevent having to add an entry for each new example. I cannot judge if for the rest of the code base it makes sense to ignore E402 completely or on a by-file-basis. |
PR Summary
We have some globs being used to define exceptions over a great many files. This instead makes them explicit. There are three reasons: 1) when running
flake8
on a single file, it won't trigger the superfluous warning if the globs are not applicable; 2) it will be easier to remove these exceptions piecemeal as things are fixed, and 3) new files can't accidentally add to the exceptions.Also, fix the spurious exception issue in
master
.PR Checklist