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

Skip to content

Commit 07752de

Browse files
authored
Merge pull request #7933 from anntzer/cleanup-not-is-is-not
Cleanup: use `is not` instead of `not ... is`, etc.
2 parents eeb5a76 + 9bf4238 commit 07752de

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4002,16 +4002,16 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
40024002
else:
40034003
colors = None # use cmap, norm after collection is created
40044004

4005-
# Anything in maskargs will be unchanged unless it is the same length
4006-
# as x:
4007-
maskargs = x, y, s, c, colors, edgecolors, linewidths
4005+
# `delete_masked_points` only modifies arguments of the same length as
4006+
# `x`.
40084007
x, y, s, c, colors, edgecolors, linewidths =\
4009-
cbook.delete_masked_points(*maskargs)
4008+
cbook.delete_masked_points(
4009+
x, y, s, c, colors, edgecolors, linewidths)
40104010

40114011
scales = s # Renamed for readability below.
40124012

40134013
# to be API compatible
4014-
if marker is None and not (verts is None):
4014+
if marker is None and verts is not None:
40154015
marker = (verts, 0)
40164016
verts = None
40174017

lib/matplotlib/cbook/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,15 +1497,12 @@ def __iter__(self):
14971497
The iterator is invalid if interleaved with calls to join().
14981498
"""
14991499
self.clean()
1500-
1501-
class Token:
1502-
pass
1503-
token = Token()
1500+
token = object()
15041501

15051502
# Mark each group as we come across if by appending a token,
15061503
# and don't yield it twice
15071504
for group in six.itervalues(self._mapping):
1508-
if not group[-1] is token:
1505+
if group[-1] is not token:
15091506
yield [x() for x in group]
15101507
group.append(token)
15111508

lib/matplotlib/mlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3348,7 +3348,7 @@ def griddata(x, y, z, xi, yi, interp='nn'):
33483348

33493349
# Remove masked points.
33503350
mask = np.ma.getmask(z)
3351-
if not (mask is np.ma.nomask):
3351+
if mask is not np.ma.nomask:
33523352
x = x.compress(~mask)
33533353
y = y.compress(~mask)
33543354
z = z.compressed()

0 commit comments

Comments
 (0)