Skip to content

Commit 47554f3

Browse files
authored
Merge pull request #28978 from scottshambaugh/mypy_errors
CI: Resolve mypy stubtest build errors
2 parents 77cbe08 + e10cd28 commit 47554f3

10 files changed

+12
-11
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import matplotlib.text as mtext
3434
import matplotlib.ticker as mticker
3535
import matplotlib.transforms as mtransforms
36-
import mpl_toolkits.axisartist as AA # type: ignore
36+
import mpl_toolkits.axisartist as AA # type: ignore[import]
3737
from numpy.testing import (
3838
assert_allclose, assert_array_equal, assert_array_almost_equal)
3939
from matplotlib.testing.decorators import (
@@ -2976,7 +2976,7 @@ def test_scatter_singular_plural_arguments(self):
29762976

29772977

29782978
def _params(c=None, xsize=2, *, edgecolors=None, **kwargs):
2979-
return (c, edgecolors, kwargs if kwargs is not None else {}, xsize)
2979+
return (c, edgecolors, kwargs, xsize)
29802980
_result = namedtuple('_result', 'c, colors')
29812981

29822982

lib/matplotlib/tests/test_backend_gtk3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def test_correct_key():
88
pytest.xfail("test_widget_send_event is not triggering key_press_event")
99

10-
from gi.repository import Gdk, Gtk # type: ignore
10+
from gi.repository import Gdk, Gtk # type: ignore[import]
1111
fig = plt.figure()
1212
buf = []
1313

lib/matplotlib/tests/test_backend_qt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
from matplotlib import _c_internal_utils
1616

1717
try:
18-
from matplotlib.backends.qt_compat import QtGui, QtWidgets # type: ignore # noqa
18+
from matplotlib.backends.qt_compat import QtGui # type: ignore[attr-defined] # noqa: E501, F401
19+
from matplotlib.backends.qt_compat import QtWidgets # type: ignore[attr-defined]
1920
from matplotlib.backends.qt_editor import _formlayout
2021
except ImportError:
2122
pytestmark = pytest.mark.skip('No usable Qt bindings')

lib/matplotlib/tests/test_backends_interactive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _get_available_interactive_backends():
8686
reason = "macosx backend fails on Azure"
8787
elif env["MPLBACKEND"].startswith('gtk'):
8888
try:
89-
import gi # type: ignore
89+
import gi # type: ignore[import]
9090
except ImportError:
9191
# Though we check that `gi` exists above, it is possible that its
9292
# C-level dependencies are not available, and then it still raises an

lib/matplotlib/tests/test_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_simple():
1111

1212

1313
def test_override_builtins():
14-
import pylab # type: ignore
14+
import pylab # type: ignore[import]
1515
ok_to_override = {
1616
'__name__',
1717
'__doc__',

lib/matplotlib/tests/test_cbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def dummy(self): pass
186186

187187

188188
class Unhashable:
189-
__hash__ = None # type: ignore
189+
__hash__ = None # type: ignore[assignment]
190190
def dummy(self): pass
191191

192192

lib/matplotlib/tests/test_collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def test_EllipseCollection_setter_getter():
456456

457457
@image_comparison(['polycollection_close.png'], remove_text=True, style='mpl20')
458458
def test_polycollection_close():
459-
from mpl_toolkits.mplot3d import Axes3D # type: ignore
459+
from mpl_toolkits.mplot3d import Axes3D # type: ignore[import]
460460
plt.rcParams['axes3d.automargin'] = True
461461

462462
vertsQuad = [

lib/matplotlib/tests/test_colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ def test_ndarray_subclass_norm():
14151415
# which objects when adding or subtracting with other
14161416
# arrays. See #6622 and #8696
14171417
class MyArray(np.ndarray):
1418-
def __isub__(self, other): # type: ignore
1418+
def __isub__(self, other): # type: ignore[misc]
14191419
raise RuntimeError
14201420

14211421
def __add__(self, other):

lib/matplotlib/tests/test_legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def test_warn_mixed_args_and_kwargs(self):
402402
"be discarded.")
403403

404404
def test_parasite(self):
405-
from mpl_toolkits.axes_grid1 import host_subplot # type: ignore
405+
from mpl_toolkits.axes_grid1 import host_subplot # type: ignore[import]
406406

407407
host = host_subplot(111)
408408
par = host.twinx()

lib/matplotlib/tests/test_pickle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import matplotlib.pyplot as plt
1818
import matplotlib.transforms as mtransforms
1919
import matplotlib.figure as mfigure
20-
from mpl_toolkits.axes_grid1 import axes_divider, parasite_axes # type: ignore
20+
from mpl_toolkits.axes_grid1 import axes_divider, parasite_axes # type: ignore[import]
2121

2222

2323
def test_simple():

0 commit comments

Comments
 (0)