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 b8eedd8

Browse filesBrowse files
committed
More uses of _deprecate_method_override.
1 parent fb199ba commit b8eedd8
Copy full SHA for b8eedd8

File tree

Expand file treeCollapse file tree

2 files changed

+10
-15
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-15
lines changed

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ def __init__(self, axes, loc, label=None,
174174
("_get_gridline", "gridline"),
175175
("_get_text1", "label1"),
176176
("_get_text2", "label2")]:
177-
if getattr(self, meth) != getattr(Tick, meth).__get__(self):
178-
cbook.warn_deprecated(
179-
"3.3", message=f"Relying on {meth} to initialize "
180-
f"Tick.{attr} is deprecated since %(since)s and will not "
181-
f"work %(removal)s; please directly set the attribute in "
182-
"the subclass' __init__ instead.")
183-
setattr(self, attr, getattr(self, meth)())
177+
overridden_method = cbook._deprecate_method_override(
178+
getattr(__class__, meth), self, since="3.3", message="Relying "
179+
f"on {meth} to initialize Tick.{attr} is deprecated since "
180+
f"%(since)s and will not work %(removal)s; please directly "
181+
f"set the attribute in the subclass' __init__ instead.")
182+
if overridden_method:
183+
setattr(self, attr, overridden_method())
184184
for artist in [self.tick1line, self.tick2line, self.gridline,
185185
self.label1, self.label2]:
186186
self._set_artist_props(artist)

‎lib/matplotlib/offsetbox.py

Copy file name to clipboardExpand all lines: lib/matplotlib/offsetbox.py
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,15 +1700,10 @@ def __init__(self, ref_artist, use_blit=False):
17001700

17011701
if not ref_artist.pickable():
17021702
ref_artist.set_picker(True)
1703-
with cbook._suppress_matplotlib_deprecation_warning():
1704-
if self.artist_picker != DraggableBase.artist_picker.__get__(self):
1705-
overridden_picker = self.artist_picker
1706-
else:
1707-
overridden_picker = None
1703+
overridden_picker = cbook._deprecate_method_override(
1704+
__class__.artist_picker, self, since="3.3",
1705+
addendum="Directly set the artist's picker if desired.")
17081706
if overridden_picker is not None:
1709-
cbook.warn_deprecated(
1710-
"3.3", name="artist_picker", obj_type="method",
1711-
addendum="Directly set the artist's picker if desired.")
17121707
ref_artist.set_picker(overridden_picker)
17131708
self.cids = [c2, c3]
17141709

0 commit comments

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