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

Skip to content

Fix % formatting and Transform equality. #8399

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
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
7 changes: 4 additions & 3 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,18 @@ def add(self, key, a):
# All the error checking may be unnecessary; but this method
# is called so seldom that the overhead is negligible.
if not isinstance(a, Axes):
raise ValueError("second argument, %s, is not an Axes" % a)
raise ValueError("second argument, {!r}, is not an Axes".format(a))
try:
hash(key)
except TypeError:
raise ValueError("first argument, %s, is not a valid key" % key)
raise ValueError(
"first argument, {!r}, is not a valid key".format(key))

a_existing = self.get(key)
if a_existing is not None:
Stack.remove(self, (key, a_existing))
warnings.warn(
"key %s already existed; Axes is being replaced" % key)
"key {!r} already existed; Axes is being replaced".format(key))
# I don't think the above should ever happen.

if a in self:
Expand Down
8 changes: 3 additions & 5 deletions lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,11 +1156,9 @@ def __radd__(self, other):
raise TypeError(
"Can not add Transform to object of type '%s'" % type(other))

def __eq__(self, other):
# equality is based on transform object id. Hence:
# Transform() != Transform().
# Some classes, such as TransformWrapper & AffineBase, will override.
return self is other
# Equality is based on object identity for `Transform`s (so we don't
# override `__eq__`), but some subclasses, such as TransformWrapper &
# AffineBase, override this behavior.

def _iter_break_from_left_to_right(self):
"""
Expand Down