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

Skip to content

Cleanup: use is not instead of not ... is, etc. #7933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Cleanup: use is not instead of not ... is, etc.
  • Loading branch information
anntzer committed Feb 6, 2017
commit 9bf4238ade9599e489f49eaca81e9689859fc05c
10 changes: 5 additions & 5 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4002,16 +4002,16 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
else:
colors = None # use cmap, norm after collection is created

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

scales = s # Renamed for readability below.

# to be API compatible
if marker is None and not (verts is None):
if marker is None and verts is not None:
marker = (verts, 0)
verts = None

Expand Down
7 changes: 2 additions & 5 deletions lib/matplotlib/cbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,15 +1497,12 @@ def __iter__(self):
The iterator is invalid if interleaved with calls to join().
"""
self.clean()

class Token:
pass
token = Token()
token = object()

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

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3348,7 +3348,7 @@ def griddata(x, y, z, xi, yi, interp='nn'):

# Remove masked points.
mask = np.ma.getmask(z)
if not (mask is np.ma.nomask):
if mask is not np.ma.nomask:
x = x.compress(~mask)
y = y.compress(~mask)
z = z.compressed()
Expand Down