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 c803bd9

Browse filesBrowse files
committed
Move from cbook._deprecate_*() to _api.deprecate_*()
1 parent d53555b commit c803bd9
Copy full SHA for c803bd9

File tree

Expand file treeCollapse file tree

14 files changed

+33
-35
lines changed
Filter options
Expand file treeCollapse file tree

14 files changed

+33
-35
lines changed

‎lib/matplotlib/_api/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_api/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from .deprecation import (
1919
deprecated, warn_deprecated,
2020
rename_parameter, delete_parameter, make_keyword_only,
21-
_deprecate_method_override, _deprecate_privatize_attribute,
21+
deprecate_method_override, deprecate_privatize_attribute,
2222
suppress_matplotlib_deprecation_warning,
2323
MatplotlibDeprecationWarning)
2424

‎lib/matplotlib/_api/deprecation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_api/deprecation.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def wrapper(*args, **kwargs):
271271
return deprecate
272272

273273

274-
class _deprecate_privatize_attribute:
274+
class deprecate_privatize_attribute:
275275
"""
276276
Helper to deprecate public access to an attribute.
277277
@@ -473,7 +473,7 @@ def wrapper(*args, **kwargs):
473473
return wrapper
474474

475475

476-
def _deprecate_method_override(method, obj, *, allow_empty=False, **kwargs):
476+
def deprecate_method_override(method, obj, *, allow_empty=False, **kwargs):
477477
"""
478478
Return ``obj.method`` with a deprecation if it was overridden, else None.
479479

‎lib/matplotlib/_mathtext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_mathtext.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def get_results(self, box):
203203
result = self.mathtext_backend.get_results(
204204
box, self.get_used_characters())
205205
if self.destroy != TruetypeFonts.destroy.__get__(self):
206-
destroy = cbook._deprecate_method_override(
206+
destroy = _api.deprecate_method_override(
207207
__class__.destroy, self, since="3.4")
208208
if destroy:
209209
destroy()

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ class MovieWriter(AbstractMovieWriter):
261261
# stored. Third-party writers cannot meaningfully set these as they cannot
262262
# extend rcParams with new keys.
263263

264-
exec_key = cbook._deprecate_privatize_attribute("3.3")
265-
args_key = cbook._deprecate_privatize_attribute("3.3")
264+
exec_key = _api.deprecate_privatize_attribute("3.3")
265+
args_key = _api.deprecate_privatize_attribute("3.3")
266266

267267
# Pipe-based writers only support RGBA, but file-based ones support more
268268
# formats.
@@ -339,7 +339,7 @@ def _run(self):
339339

340340
def finish(self):
341341
"""Finish any processing for writing the movie."""
342-
overridden_cleanup = cbook._deprecate_method_override(
342+
overridden_cleanup = _api.deprecate_method_override(
343343
__class__.cleanup, self, since="3.4", alternative="finish()")
344344
if overridden_cleanup is not None:
345345
overridden_cleanup()

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def __init__(self, axes, loc, label=None,
179179
("_get_gridline", "gridline"),
180180
("_get_text1", "label1"),
181181
("_get_text2", "label2")]:
182-
overridden_method = cbook._deprecate_method_override(
182+
overridden_method = _api.deprecate_method_override(
183183
getattr(__class__, meth), self, since="3.3", message="Relying "
184184
f"on {meth} to initialize Tick.{attr} is deprecated since "
185185
f"%(since)s and will not work %(removal)s; please directly "

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2876,7 +2876,7 @@ def __init__(self, canvas):
28762876
# This cursor will be set after the initial draw.
28772877
self._lastCursor = cursors.POINTER
28782878

2879-
init = cbook._deprecate_method_override(
2879+
init = _api.deprecate_method_override(
28802880
__class__._init_toolbar, self, allow_empty=True, since="3.3",
28812881
addendum="Please fully initialize the toolbar in your subclass' "
28822882
"__init__; a fully empty _init_toolbar implementation may be kept "
@@ -3093,7 +3093,7 @@ def press_pan(self, event):
30933093
id_drag = self.canvas.mpl_connect("motion_notify_event", self.drag_pan)
30943094
self._pan_info = self._PanInfo(
30953095
button=event.button, axes=axes, cid=id_drag)
3096-
press = cbook._deprecate_method_override(
3096+
press = _api.deprecate_method_override(
30973097
__class__.press, self, since="3.3", message="Calling an "
30983098
"overridden press() at pan start is deprecated since %(since)s "
30993099
"and will be removed %(removal)s; override press_pan() instead.")
@@ -3117,7 +3117,7 @@ def release_pan(self, event):
31173117
'motion_notify_event', self.mouse_move)
31183118
for ax in self._pan_info.axes:
31193119
ax.end_pan()
3120-
release = cbook._deprecate_method_override(
3120+
release = _api.deprecate_method_override(
31213121
__class__.press, self, since="3.3", message="Calling an "
31223122
"overridden release() at pan stop is deprecated since %(since)s "
31233123
"and will be removed %(removal)s; override release_pan() instead.")
@@ -3157,7 +3157,7 @@ def press_zoom(self, event):
31573157
self._zoom_info = self._ZoomInfo(
31583158
direction="in" if event.button == 1 else "out",
31593159
start_xy=(event.x, event.y), axes=axes, cid=id_zoom)
3160-
press = cbook._deprecate_method_override(
3160+
press = _api.deprecate_method_override(
31613161
__class__.press, self, since="3.3", message="Calling an "
31623162
"overridden press() at zoom start is deprecated since %(since)s "
31633163
"and will be removed %(removal)s; override press_zoom() instead.")
@@ -3193,7 +3193,7 @@ def release_zoom(self, event):
31933193
or (abs(event.y - start_y) < 5 and event.key != "x")):
31943194
self._draw()
31953195
self._zoom_info = None
3196-
release = cbook._deprecate_method_override(
3196+
release = _api.deprecate_method_override(
31973197
__class__.press, self, since="3.3", message="Calling an "
31983198
"overridden release() at zoom stop is deprecated since "
31993199
"%(since)s and will be removed %(removal)s; override "
@@ -3217,7 +3217,7 @@ def release_zoom(self, event):
32173217
self._zoom_info = None
32183218
self.push_current()
32193219

3220-
release = cbook._deprecate_method_override(
3220+
release = _api.deprecate_method_override(
32213221
__class__.release, self, since="3.3", message="Calling an "
32223222
"overridden release() at zoom stop is deprecated since %(since)s "
32233223
"and will be removed %(removal)s; override release_zoom() "

‎lib/matplotlib/backends/backend_gtk3.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __init__(self, figure):
127127
self.set_double_buffered(True)
128128
self.set_can_focus(True)
129129

130-
renderer_init = cbook._deprecate_method_override(
130+
renderer_init = _api.deprecate_method_override(
131131
__class__._renderer_init, self, allow_empty=True, since="3.3",
132132
addendum="Please initialize the renderer, if needed, in the "
133133
"subclass' __init__; a fully empty _renderer_init implementation "

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,13 +1129,13 @@ def __init__(self, canvas, coordinates=True):
11291129
# and/or dc.GetContentScaleFactor()
11301130
self._retinaFix = 'wxMac' in wx.PlatformInfo
11311131

1132-
prevZoomRect = cbook._deprecate_privatize_attribute("3.3")
1133-
retinaFix = cbook._deprecate_privatize_attribute("3.3")
1134-
savedRetinaImage = cbook._deprecate_privatize_attribute("3.3")
1135-
wxoverlay = cbook._deprecate_privatize_attribute("3.3")
1136-
zoomAxes = cbook._deprecate_privatize_attribute("3.3")
1137-
zoomStartX = cbook._deprecate_privatize_attribute("3.3")
1138-
zoomStartY = cbook._deprecate_privatize_attribute("3.3")
1132+
prevZoomRect = _api.deprecate_privatize_attribute("3.3")
1133+
retinaFix = _api.deprecate_privatize_attribute("3.3")
1134+
savedRetinaImage = _api.deprecate_privatize_attribute("3.3")
1135+
wxoverlay = _api.deprecate_privatize_attribute("3.3")
1136+
zoomAxes = _api.deprecate_privatize_attribute("3.3")
1137+
zoomStartX = _api.deprecate_privatize_attribute("3.3")
1138+
zoomStartY = _api.deprecate_privatize_attribute("3.3")
11391139

11401140
@staticmethod
11411141
def _icon(name):

‎lib/matplotlib/cbook/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
from matplotlib._api import (
3333
warn_external as _warn_external, classproperty as _classproperty)
3434
from matplotlib._api.deprecation import (
35-
deprecated, warn_deprecated,
36-
_deprecate_method_override, _deprecate_privatize_attribute,
37-
MatplotlibDeprecationWarning, mplDeprecation)
35+
deprecated, warn_deprecated, MatplotlibDeprecationWarning, mplDeprecation)
3836

3937

4038
def _get_running_interactive_framework():

‎lib/matplotlib/cm.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cm.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ def changed(self):
500500
self._update_dict[key] = True
501501
self.stale = True
502502

503-
update_dict = cbook._deprecate_privatize_attribute("3.3")
503+
update_dict = _api.deprecate_privatize_attribute("3.3")
504504

505505
@_api.deprecated("3.3")
506506
def add_checker(self, checker):

‎lib/matplotlib/image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ def _check_unsampled_image(self):
10261026
"""Return False. Do not use unsampled image."""
10271027
return False
10281028

1029-
is_grayscale = cbook._deprecate_privatize_attribute("3.3")
1029+
is_grayscale = _api.deprecate_privatize_attribute("3.3")
10301030

10311031
def make_image(self, renderer, magnification=1.0, unsampled=False):
10321032
# docstring inherited
@@ -1177,7 +1177,7 @@ def __init__(self, ax,
11771177
if A is not None:
11781178
self.set_data(x, y, A)
11791179

1180-
is_grayscale = cbook._deprecate_privatize_attribute("3.3")
1180+
is_grayscale = _api.deprecate_privatize_attribute("3.3")
11811181

11821182
def make_image(self, renderer, magnification=1.0, unsampled=False):
11831183
# docstring inherited

‎lib/matplotlib/offsetbox.py

Copy file name to clipboardExpand all lines: lib/matplotlib/offsetbox.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import numpy as np
2626

27-
from matplotlib import _api, cbook, docstring, rcParams
27+
from matplotlib import _api, docstring, rcParams
2828
import matplotlib.artist as martist
2929
import matplotlib.path as mpath
3030
import matplotlib.text as mtext
@@ -1630,7 +1630,7 @@ def __init__(self, ref_artist, use_blit=False):
16301630

16311631
if not ref_artist.pickable():
16321632
ref_artist.set_picker(True)
1633-
overridden_picker = cbook._deprecate_method_override(
1633+
overridden_picker = _api.deprecate_method_override(
16341634
__class__.artist_picker, self, since="3.3",
16351635
addendum="Directly set the artist's picker if desired.")
16361636
if overridden_picker is not None:

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ def __init__(self, patch, ox, oy, props=None, **kwargs):
677677
self._shadow_transform = transforms.Affine2D()
678678
self._update()
679679

680-
props = cbook._deprecate_privatize_attribute("3.3")
680+
props = _api.deprecate_privatize_attribute("3.3")
681681

682682
def _update(self):
683683
self.update_from(self.patch)
@@ -2006,7 +2006,7 @@ def transmute(self, x0, y0, width, height, mutation_size):
20062006
# This can go away once the deprecation period elapses, leaving _Base
20072007
# as a fully abstract base class just providing docstrings, no logic.
20082008
def __init_subclass__(cls):
2009-
transmute = cbook._deprecate_method_override(
2009+
transmute = _api.deprecate_method_override(
20102010
__class__.transmute, cls, since="3.4")
20112011
if transmute:
20122012
cls.__call__ = transmute

‎lib/mpl_toolkits/axes_grid1/axes_grid.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axes_grid1/axes_grid.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55

66
import matplotlib as mpl
7-
from matplotlib import _api, cbook
7+
from matplotlib import _api
88
from matplotlib.gridspec import SubplotSpec
99

1010
from .axes_divider import Size, SubplotDivider, Divider
@@ -40,9 +40,9 @@ def colorbar(self, mappable, *, ticks=None, **kwargs):
4040
self._config_axes()
4141
return cb
4242

43-
cbid = cbook._deprecate_privatize_attribute(
43+
cbid = _api.deprecate_privatize_attribute(
4444
"3.3", alternative="mappable.colorbar_cid")
45-
locator = cbook._deprecate_privatize_attribute(
45+
locator = _api.deprecate_privatize_attribute(
4646
"3.3", alternative=".colorbar().locator")
4747

4848
def _config_axes(self):

0 commit comments

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