False positive when importing Axes3D
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
Won't Fix
|
Wishlist
|
Unassigned |
Bug Description
The following script gives the pyflakes warning "'Axes3D' imported but unused". However, the import is necessary.
from https:/
```
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
from mpl_toolkits.
fig = plt.figure()
ax = fig.gca(
X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm)
plt.show()
```
As a workaround, I have added the line
> assert Axes3D # suppress "unused import" warning
after the import, since "# NOQA" does not work (https:/
Changed in pyflakes: | |
status: | New → Won't Fix |
Why is it necessary? Do you want it to be available in your module's namespace? Then you can reference it in __all__ to suppress the warning. Or do you just need to import it for some side effect? That's not a great design, but if you can't change that, then you should be able to `del Axes3D` to avoid the warning.
Do either of these solutions work?