Skip to content

MNT: Clean up some style exceptions#27546

Merged
oscargus merged 3 commits intomatplotlib:mainfrom
QuLogic:explicit-style-exceptions
Dec 20, 2023
Merged

MNT: Clean up some style exceptions#27546
oscargus merged 3 commits intomatplotlib:mainfrom
QuLogic:explicit-style-exceptions

Conversation

@QuLogic
Copy link
Copy Markdown
Member

@QuLogic QuLogic commented Dec 20, 2023

PR summary

In these cases, a very small percentage of a file really needs an exception, so we can either add a noqa comment, or fix the style issue directly.

In files like pyplot.py, the file-level exception was obscuring that imports like re were unused, or that typing.cast was imported twice.

PR checklist

... instead of using a full file ignore. This allows catching a few more
unused imports.
There's only one or two lines that need this exception, so the entire
file doesn't need to be exempted.
There are really not very many of these to justify exempting the entire
file, and they are easily fixed.
Copy link
Copy Markdown
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we‘ve said some time ago, that we don’t want to litter the code with noqa comments, I think it makes sense for some special cases. The alternative of globally applying the exception to a file is too coarse and can hide errors.

@oscargus oscargus merged commit 30ddba9 into matplotlib:main Dec 20, 2023
@oscargus oscargus added this to the v3.9.0 milestone Dec 20, 2023
@QuLogic QuLogic deleted the explicit-style-exceptions branch December 20, 2023 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants