Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d80c9ce

Browse filesBrowse files
oscargusQuLogic
authored andcommitted
Backport PR matplotlib#26414: Fixes for pycodestyle v2.11
(cherry picked from commit f7a8cab)
1 parent 7c6b465 commit d80c9ce
Copy full SHA for d80c9ce

File tree

7 files changed

+13
-14
lines changed
Filter options

7 files changed

+13
-14
lines changed

‎examples/misc/packed_bubbles.py

Copy file name to clipboardExpand all lines: examples/misc/packed_bubbles.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ def check_collisions(self, bubble, bubbles):
7676

7777
def collides_with(self, bubble, bubbles):
7878
distance = self.outline_distance(bubble, bubbles)
79-
idx_min = np.argmin(distance)
80-
return idx_min if type(idx_min) == np.ndarray else [idx_min]
79+
return np.argmin(distance, keepdims=True)
8180

8281
def collapse(self, n_iterations=50):
8382
"""

‎lib/matplotlib/dviread.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dviread.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ def __init__(self, scale, tfm, texname, vf):
622622
for char in range(nchars)]
623623

624624
def __eq__(self, other):
625-
return (type(self) == type(other)
625+
return (type(self) is type(other)
626626
and self.texname == other.texname and self.size == other.size)
627627

628628
def __ne__(self, other):

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ def set_fontconfig_pattern(self, pattern):
851851
pattern syntax for use here.
852852
"""
853853
for key, val in parse_fontconfig_pattern(pattern).items():
854-
if type(val) == list:
854+
if type(val) is list:
855855
getattr(self, "set_" + key)(val[0])
856856
else:
857857
getattr(self, "set_" + key)(val)

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,12 +2834,12 @@ def _as_mpl_axes(self):
28342834

28352835
# testing axes creation with plt.axes
28362836
ax = plt.axes([0, 0, 1, 1], projection=prj)
2837-
assert type(ax) == PolarAxes
2837+
assert type(ax) is PolarAxes
28382838
plt.close()
28392839

28402840
# testing axes creation with subplot
28412841
ax = plt.subplot(121, projection=prj)
2842-
assert type(ax) == PolarAxes
2842+
assert type(ax) is PolarAxes
28432843
plt.close()
28442844

28452845

‎lib/matplotlib/tests/test_cbook.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_cbook.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def test_callback_complete(self, pickle):
224224

225225
# test that we can add a callback
226226
cid1 = self.connect(self.signal, mini_me.dummy, pickle)
227-
assert type(cid1) == int
227+
assert type(cid1) is int
228228
self.is_not_empty()
229229

230230
# test that we don't add a second callback
@@ -249,7 +249,7 @@ def test_callback_disconnect(self, pickle):
249249

250250
# test that we can add a callback
251251
cid1 = self.connect(self.signal, mini_me.dummy, pickle)
252-
assert type(cid1) == int
252+
assert type(cid1) is int
253253
self.is_not_empty()
254254

255255
self.disconnect(cid1)
@@ -267,7 +267,7 @@ def test_callback_wrong_disconnect(self, pickle):
267267

268268
# test that we can add a callback
269269
cid1 = self.connect(self.signal, mini_me.dummy, pickle)
270-
assert type(cid1) == int
270+
assert type(cid1) is int
271271
self.is_not_empty()
272272

273273
self.disconnect("foo")

‎lib/matplotlib/tests/test_image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_image.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,6 @@ def test_str_norms(fig_test, fig_ref):
14611461
axrs[3].imshow(t, norm=colors.SymLogNorm(linthresh=2, vmin=.3, vmax=.7))
14621462
axrs[4].imshow(t, norm="logit", clim=(.3, .7))
14631463

1464-
assert type(axts[0].images[0].norm) == colors.LogNorm # Exactly that class
1464+
assert type(axts[0].images[0].norm) is colors.LogNorm # Exactly that class
14651465
with pytest.raises(ValueError):
14661466
axts[0].imshow(t, norm="foobar")

‎lib/matplotlib/tests/test_scale.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_scale.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,22 @@ def test_symlog_mask_nan():
3737
x = np.arange(-1.5, 5, 0.5)
3838
out = slti.transform_non_affine(slt.transform_non_affine(x))
3939
assert_allclose(out, x)
40-
assert type(out) == type(x)
40+
assert type(out) is type(x)
4141

4242
x[4] = np.nan
4343
out = slti.transform_non_affine(slt.transform_non_affine(x))
4444
assert_allclose(out, x)
45-
assert type(out) == type(x)
45+
assert type(out) is type(x)
4646

4747
x = np.ma.array(x)
4848
out = slti.transform_non_affine(slt.transform_non_affine(x))
4949
assert_allclose(out, x)
50-
assert type(out) == type(x)
50+
assert type(out) is type(x)
5151

5252
x[3] = np.ma.masked
5353
out = slti.transform_non_affine(slt.transform_non_affine(x))
5454
assert_allclose(out, x)
55-
assert type(out) == type(x)
55+
assert type(out) is type(x)
5656

5757

5858
@image_comparison(['logit_scales.png'], remove_text=True)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.