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

Skip to content

Commit f7a8cab

Browse files
authored
Merge pull request #26414 from rcomer/flake8-fixes
Fixes for pycodestyle v2.11
2 parents c36a03f + 1774d8c commit f7a8cab

File tree

7 files changed

+13
-14
lines changed

7 files changed

+13
-14
lines changed

galleries/examples/misc/packed_bubbles.py

Lines 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

Lines 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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ def set_fontconfig_pattern(self, pattern):
853853
pattern syntax for use here.
854854
"""
855855
for key, val in parse_fontconfig_pattern(pattern).items():
856-
if type(val) == list:
856+
if type(val) is list:
857857
getattr(self, "set_" + key)(val[0])
858858
else:
859859
getattr(self, "set_" + key)(val)

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,12 +2949,12 @@ def _as_mpl_axes(self):
29492949

29502950
# testing axes creation with plt.axes
29512951
ax = plt.axes((0, 0, 1, 1), projection=prj)
2952-
assert type(ax) == PolarAxes
2952+
assert type(ax) is PolarAxes
29532953
plt.close()
29542954

29552955
# testing axes creation with subplot
29562956
ax = plt.subplot(121, projection=prj)
2957-
assert type(ax) == PolarAxes
2957+
assert type(ax) is PolarAxes
29582958
plt.close()
29592959

29602960

lib/matplotlib/tests/test_cbook.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def test_callback_complete(self, pickle):
226226

227227
# test that we can add a callback
228228
cid1 = self.connect(self.signal, mini_me.dummy, pickle)
229-
assert type(cid1) == int
229+
assert type(cid1) is int
230230
self.is_not_empty()
231231

232232
# test that we don't add a second callback
@@ -251,7 +251,7 @@ def test_callback_disconnect(self, pickle):
251251

252252
# test that we can add a callback
253253
cid1 = self.connect(self.signal, mini_me.dummy, pickle)
254-
assert type(cid1) == int
254+
assert type(cid1) is int
255255
self.is_not_empty()
256256

257257
self.disconnect(cid1)
@@ -269,7 +269,7 @@ def test_callback_wrong_disconnect(self, pickle):
269269

270270
# test that we can add a callback
271271
cid1 = self.connect(self.signal, mini_me.dummy, pickle)
272-
assert type(cid1) == int
272+
assert type(cid1) is int
273273
self.is_not_empty()
274274

275275
self.disconnect("foo")

lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ def test_str_norms(fig_test, fig_ref):
14631463
axrs[3].imshow(t, norm=colors.SymLogNorm(linthresh=2, vmin=.3, vmax=.7))
14641464
axrs[4].imshow(t, norm="logit", clim=(.3, .7))
14651465

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

lib/matplotlib/tests/test_scale.py

Lines 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)