Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MNT: Remove unused imports #23554

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 4 commits into from
Aug 18, 2022
Merged

MNT: Remove unused imports #23554

merged 4 commits into from
Aug 18, 2022

Conversation

oscargus
Copy link
Member

@oscargus oscargus commented Aug 4, 2022

PR Summary

Found some unused imports.

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (and pytest passes).
  • [N/A] Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).

@QuLogic
Copy link
Member

QuLogic commented Aug 4, 2022

It looks like this is caused by this blanket exception; perhaps that can be removed now?

@oscargus
Copy link
Member Author

oscargus commented Aug 4, 2022

It looks like this is caused by this blanket exception; perhaps that can be removed now?

There are still unused imports in backends, but ones that I believe are required, like the FigureManagers etc. I guess one can mark the lines, which I am strongly in favour of instead of the file, but it will take some time...

@anntzer
Copy link
Contributor

anntzer commented Aug 4, 2022

Perhaps you can remove F401 for all backends from .flake8 (and put in a more targeted exclusion if needed)?

@oscargus
Copy link
Member Author

oscargus commented Aug 4, 2022

New change where I started to use __all__, which seems like it hasn't been used earlier. For some files it is a bit of a hassle, so I selected the relatively easy ones.

There is a minor risk for breakage. For example, it is in current main possible to import numpy as:

from matplotlib.tri import np

This is no longer possible after this change.

@@ -46,7 +46,7 @@
import matplotlib.axes as maxes
from matplotlib.path import Path
from mpl_toolkits.axes_grid1 import mpl_axes
from .axisline_style import AxislineStyle
from .axisline_style import AxislineStyle # noqa
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe one should deprecate this? Not sure if someone is actually importing it from here?

@oscargus oscargus marked this pull request as draft August 4, 2022 21:43
@oscargus
Copy link
Member Author

oscargus commented Aug 4, 2022

Converting to draft until I have had time to think about the tri documentation issue.

@QuLogic QuLogic self-requested a review August 4, 2022 21:50
@oscargus oscargus marked this pull request as ready for review August 5, 2022 13:03
@tacaswell tacaswell added this to the v3.6.0 milestone Aug 5, 2022
@anntzer anntzer merged commit 23100c4 into matplotlib:main Aug 18, 2022
@oscargus oscargus deleted the unusedimports branch August 18, 2022 20:28
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.

4 participants