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 410c51d

Browse filesBrowse files
committed
Move internal usage from cbook._delete_parameter to _api.delete_parameter
1 parent 76709a4 commit 410c51d
Copy full SHA for 410c51d
Expand file treeCollapse file tree

30 files changed

+81
-82
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ def _init_tests():
11941194
"" if ft2font.__freetype_build_type__ == 'local' else "not "))
11951195

11961196

1197-
@cbook._delete_parameter("3.3", "recursionlimit")
1197+
@_api.delete_parameter("3.3", "recursionlimit")
11981198
def test(verbosity=None, coverage=False, *, recursionlimit=0, **kwargs):
11991199
"""Run the matplotlib test suite."""
12001200

‎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
@@ -17,7 +17,7 @@
1717

1818
from .deprecation import (
1919
deprecated, warn_deprecated,
20-
rename_parameter, _delete_parameter, make_keyword_only,
20+
rename_parameter, delete_parameter, make_keyword_only,
2121
_deprecate_method_override, _deprecate_privatize_attribute,
2222
suppress_matplotlib_deprecation_warning,
2323
MatplotlibDeprecationWarning)

‎lib/matplotlib/_api/deprecation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_api/deprecation.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def __repr__(self):
350350
_deprecated_parameter = _deprecated_parameter_class()
351351

352352

353-
def _delete_parameter(since, name, func=None, **kwargs):
353+
def delete_parameter(since, name, func=None, **kwargs):
354354
"""
355355
Decorator indicating that parameter *name* of *func* is being deprecated.
356356
@@ -371,12 +371,12 @@ def _delete_parameter(since, name, func=None, **kwargs):
371371
--------
372372
::
373373
374-
@_delete_parameter("3.1", "unused")
374+
@_api.delete_parameter("3.1", "unused")
375375
def func(used_arg, other_arg, unused, more_args): ...
376376
"""
377377

378378
if func is None:
379-
return functools.partial(_delete_parameter, since, name, **kwargs)
379+
return functools.partial(delete_parameter, since, name, **kwargs)
380380

381381
signature = inspect.signature(func)
382382
# Name of `**kwargs` parameter of the decorated function, typically

‎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
@@ -1551,7 +1551,7 @@ class Glue(Node):
15511551

15521552
glue_subtype = cbook.deprecated("3.3")(property(lambda self: "normal"))
15531553

1554-
@cbook._delete_parameter("3.3", "copy")
1554+
@_api.delete_parameter("3.3", "copy")
15551555
def __init__(self, glue_type, copy=False):
15561556
super().__init__()
15571557
if isinstance(glue_type, str):

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def __init__(self, *args, **kwargs):
407407
super().__init__(*args, **kwargs)
408408
self.frame_format = mpl.rcParams['animation.frame_format']
409409

410-
@cbook._delete_parameter("3.3", "clear_temp")
410+
@_api.delete_parameter("3.3", "clear_temp")
411411
def setup(self, fig, outfile, dpi=None, frame_prefix=None,
412412
clear_temp=True):
413413
"""

‎lib/matplotlib/artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/artist.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def allow_rasterization(draw):
2828

2929
# Axes has a second (deprecated) argument inframe for its draw method.
3030
# args and kwargs are deprecated, but we don't wrap this in
31-
# cbook._delete_parameter for performance; the relevant deprecation
31+
# _api.delete_parameter for performance; the relevant deprecation
3232
# warning will be emitted by the inner draw() call.
3333
@wraps(draw)
3434
def draw_wrapper(artist, renderer, *args, **kwargs):
@@ -926,8 +926,8 @@ def set_agg_filter(self, filter_func):
926926
self._agg_filter = filter_func
927927
self.stale = True
928928

929-
@cbook._delete_parameter("3.3", "args")
930-
@cbook._delete_parameter("3.3", "kwargs")
929+
@_api.delete_parameter("3.3", "args")
930+
@_api.delete_parameter("3.3", "kwargs")
931931
def draw(self, renderer, *args, **kwargs):
932932
"""
933933
Draw the Artist (and its children) using the given renderer.

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2743,7 +2743,7 @@ def _update_title_position(self, renderer):
27432743

27442744
# Drawing
27452745
@martist.allow_rasterization
2746-
@cbook._delete_parameter(
2746+
@_api.delete_parameter(
27472747
"3.3", "inframe", alternative="Axes.redraw_in_frame()")
27482748
def draw(self, renderer=None, inframe=False):
27492749
# docstring inherited

‎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
@@ -54,7 +54,7 @@ class Tick(martist.Artist):
5454
The right/top tick label.
5555
5656
"""
57-
@cbook._delete_parameter("3.3", "label")
57+
@_api.delete_parameter("3.3", "label")
5858
def __init__(self, axes, loc, label=None,
5959
size=None, # points
6060
width=None,

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def option_scale_image(self):
535535
"""
536536
return False
537537

538-
@cbook._delete_parameter("3.3", "ismath")
538+
@_api.delete_parameter("3.3", "ismath")
539539
def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
540540
"""
541541
"""

‎lib/matplotlib/backend_managers.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_managers.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22

3-
import matplotlib.cbook as cbook
4-
import matplotlib.widgets as widgets
3+
from matplotlib import _api, cbook, widgets
54
from matplotlib.rcsetup import validate_stringlist
65
import matplotlib.backend_tools as tools
76

@@ -183,7 +182,7 @@ def _remove_keys(self, name):
183182
for k in self.get_tool_keymap(name):
184183
del self._keys[k]
185184

186-
@cbook._delete_parameter("3.3", "args")
185+
@_api.delete_parameter("3.3", "args")
187186
def update_keymap(self, name, key, *args):
188187
"""
189188
Set the keymap to associate with the specified tool.

‎lib/matplotlib/backends/_backend_tk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/_backend_tk.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def _on_timer(self):
159159
class FigureCanvasTk(FigureCanvasBase):
160160
required_interactive_framework = "tk"
161161

162-
@cbook._delete_parameter(
162+
@_api.delete_parameter(
163163
"3.4", "resize_callback",
164164
alternative="get_tk_widget().bind('<Configure>', ..., True)")
165165
def __init__(self, figure, master=None, resize_callback=None):

‎lib/matplotlib/backends/backend_agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_agg.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,12 @@ def print_to_buffer(self):
522522

523523
@_check_savefig_extra_args(
524524
extra_kwargs=["quality", "optimize", "progressive"])
525-
@cbook._delete_parameter("3.3", "quality",
526-
alternative="pil_kwargs={'quality': ...}")
527-
@cbook._delete_parameter("3.3", "optimize",
528-
alternative="pil_kwargs={'optimize': ...}")
529-
@cbook._delete_parameter("3.3", "progressive",
530-
alternative="pil_kwargs={'progressive': ...}")
525+
@_api.delete_parameter("3.3", "quality",
526+
alternative="pil_kwargs={'quality': ...}")
527+
@_api.delete_parameter("3.3", "optimize",
528+
alternative="pil_kwargs={'optimize': ...}")
529+
@_api.delete_parameter("3.3", "progressive",
530+
alternative="pil_kwargs={'progressive': ...}")
531531
def print_jpg(self, filename_or_obj, *args, pil_kwargs=None, **kwargs):
532532
"""
533533
Write the figure to a JPEG file.

‎lib/matplotlib/backends/backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2155,7 +2155,7 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
21552155
# Pop off the global transformation
21562156
self.file.output(Op.grestore)
21572157

2158-
@cbook._delete_parameter("3.3", "ismath")
2158+
@_api.delete_parameter("3.3", "ismath")
21592159
def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
21602160
# docstring inherited
21612161
texmanager = self.get_texmanager()

‎lib/matplotlib/backends/backend_pgf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pgf.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def _get_image_inclusion_command():
380380

381381
class RendererPgf(RendererBase):
382382

383-
@cbook._delete_parameter("3.3", "dummy")
383+
@_api.delete_parameter("3.3", "dummy")
384384
def __init__(self, figure, fh, dummy=False):
385385
"""
386386
Create a new PGF renderer that translates any drawing instruction

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
554554

555555
self._path_collection_id += 1
556556

557-
@cbook._delete_parameter("3.3", "ismath")
557+
@_api.delete_parameter("3.3", "ismath")
558558
def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
559559
# docstring inherited
560560
if not hasattr(self, "psfrag"):

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
12381238

12391239
writer.end('g')
12401240

1241-
@cbook._delete_parameter("3.3", "ismath")
1241+
@_api.delete_parameter("3.3", "ismath")
12421242
def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
12431243
# docstring inherited
12441244
self._draw_text_as_path(gc, x, y, s, prop, angle, ismath="TeX")

‎lib/matplotlib/backends/backend_wx.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def _get_imagesave_wildcards(self):
599599
wildcards = '|'.join(wildcards)
600600
return wildcards, extensions, filter_index
601601

602-
@cbook._delete_parameter("3.4", "origin")
602+
@_api.delete_parameter("3.4", "origin")
603603
def gui_repaint(self, drawDC=None, origin='WX'):
604604
"""
605605
Performs update of the displayed image on the GUI canvas, using the

‎lib/matplotlib/cbook/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
import numpy as np
2929

3030
import matplotlib
31-
from matplotlib import _c_internal_utils
31+
from matplotlib import _api, _c_internal_utils
3232
from matplotlib._api import (
3333
warn_external as _warn_external, classproperty as _classproperty)
3434
from matplotlib._api.deprecation import (
3535
deprecated, warn_deprecated,
36-
_delete_parameter,
3736
_deprecate_method_override, _deprecate_privatize_attribute,
3837
MatplotlibDeprecationWarning, mplDeprecation)
3938

@@ -1704,9 +1703,9 @@ def sanitize_sequence(data):
17041703
else data)
17051704

17061705

1707-
@_delete_parameter("3.3", "required")
1708-
@_delete_parameter("3.3", "forbidden")
1709-
@_delete_parameter("3.3", "allowed")
1706+
@_api.delete_parameter("3.3", "required")
1707+
@_api.delete_parameter("3.3", "forbidden")
1708+
@_api.delete_parameter("3.3", "allowed")
17101709
def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),
17111710
allowed=None):
17121711
"""

‎lib/matplotlib/collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Collection(artist.Artist, cm.ScalarMappable):
7070
# subclass-by-subclass basis.
7171
_edge_default = False
7272

73-
@cbook._delete_parameter("3.3", "offset_position")
73+
@_api.delete_parameter("3.3", "offset_position")
7474
def __init__(self,
7575
edgecolors=None,
7676
facecolors=None,

‎lib/matplotlib/gridspec.py

Copy file name to clipboardExpand all lines: lib/matplotlib/gridspec.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ def is_first_col(self):
723723
def is_last_col(self):
724724
return self.colspan.stop == self.get_gridspec().ncols
725725

726-
@cbook._delete_parameter("3.4", "return_all")
726+
@_api.delete_parameter("3.4", "return_all")
727727
def get_position(self, figure, return_all=False):
728728
"""
729729
Update the subplot position from ``figure.subplotpars``.

‎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
@@ -706,7 +706,7 @@ class TextArea(OffsetBox):
706706
child text.
707707
"""
708708

709-
@cbook._delete_parameter("3.4", "minimumdescent")
709+
@_api.delete_parameter("3.4", "minimumdescent")
710710
def __init__(self, s,
711711
textprops=None,
712712
multilinebaseline=False,
@@ -1480,7 +1480,7 @@ def set_fontsize(self, s=None):
14801480
self.prop = FontProperties(size=s)
14811481
self.stale = True
14821482

1483-
@cbook._delete_parameter("3.3", "s")
1483+
@_api.delete_parameter("3.3", "s")
14841484
def get_fontsize(self, s=None):
14851485
"""Return the fontsize in points."""
14861486
return self.prop.get_size_in_points()

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ class Shadow(Patch):
638638
def __str__(self):
639639
return "Shadow(%s)" % (str(self.patch))
640640

641-
@cbook._delete_parameter("3.3", "props")
641+
@_api.delete_parameter("3.3", "props")
642642
@docstring.dedent_interpd
643643
def __init__(self, patch, ox, oy, props=None, **kwargs):
644644
"""
@@ -2014,7 +2014,7 @@ def __init_subclass__(cls):
20142014

20152015
__call__ = cls.__call__
20162016

2017-
@cbook._delete_parameter("3.4", "mutation_aspect")
2017+
@_api.delete_parameter("3.4", "mutation_aspect")
20182018
def call_wrapper(
20192019
self, x0, y0, width, height, mutation_size,
20202020
mutation_aspect=_api.deprecation._deprecated_parameter):
@@ -3602,7 +3602,7 @@ def __str__(self):
36023602
return s % (self._x, self._y, self._width, self._height)
36033603

36043604
@docstring.dedent_interpd
3605-
@cbook._delete_parameter("3.4", "bbox_transmuter", alternative="boxstyle")
3605+
@_api.delete_parameter("3.4", "bbox_transmuter", alternative="boxstyle")
36063606
def __init__(self, xy, width, height,
36073607
boxstyle="round", bbox_transmuter=None,
36083608
mutation_scale=1, mutation_aspect=1,
@@ -3893,7 +3893,7 @@ def __str__(self):
38933893
return f"{type(self).__name__}({self._path_original})"
38943894

38953895
@docstring.dedent_interpd
3896-
@cbook._delete_parameter("3.4", "dpi_cor")
3896+
@_api.delete_parameter("3.4", "dpi_cor")
38973897
def __init__(self, posA=None, posB=None, path=None,
38983898
arrowstyle="simple", connectionstyle="arc3",
38993899
patchA=None, patchB=None,
@@ -4240,7 +4240,7 @@ def __str__(self):
42404240
(self.xy1[0], self.xy1[1], self.xy2[0], self.xy2[1])
42414241

42424242
@docstring.dedent_interpd
4243-
@cbook._delete_parameter("3.4", "dpi_cor")
4243+
@_api.delete_parameter("3.4", "dpi_cor")
42444244
def __init__(self, xyA, xyB, coordsA, coordsB=None,
42454245
axesA=None, axesB=None,
42464246
arrowstyle="-",

‎lib/matplotlib/path.py

Copy file name to clipboardExpand all lines: lib/matplotlib/path.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import numpy as np
1616

1717
import matplotlib as mpl
18-
from . import _api, _path, cbook
18+
from . import _api, _path
1919
from .cbook import _to_unmasked_float_array, simple_linear_interpolation
2020
from .bezier import BezierSegment
2121

@@ -461,7 +461,7 @@ def iter_bezier(self, **kwargs):
461461
raise ValueError("Invalid Path.code_type: " + str(code))
462462
prev_vert = verts[-2:]
463463

464-
@cbook._delete_parameter("3.3", "quantize")
464+
@_api.delete_parameter("3.3", "quantize")
465465
def cleaned(self, transform=None, remove_nans=False, clip=None,
466466
quantize=False, simplify=False, curves=False,
467467
stroke_width=1.0, snap=False, sketch=None):

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,8 @@ def get_yaxis_text2_transform(self, pad):
945945
pad_shift = _ThetaShift(self, pad, 'min')
946946
return self._yaxis_text_transform + pad_shift, 'center', halign
947947

948-
@cbook._delete_parameter("3.3", "args")
949-
@cbook._delete_parameter("3.3", "kwargs")
948+
@_api.delete_parameter("3.3", "args")
949+
@_api.delete_parameter("3.3", "kwargs")
950950
def draw(self, renderer, *args, **kwargs):
951951
self._unstale_viewLim()
952952
thetamin, thetamax = np.rad2deg(self._realViewLim.intervalx)

‎lib/matplotlib/scale.py

Copy file name to clipboardExpand all lines: lib/matplotlib/scale.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from numpy import ma
1515

1616
import matplotlib as mpl
17-
from matplotlib import _api, cbook, docstring
17+
from matplotlib import _api, docstring
1818
from matplotlib.ticker import (
1919
NullFormatter, ScalarFormatter, LogFormatterSciNotation, LogitFormatter,
2020
NullLocator, LogLocator, AutoLocator, AutoMinorLocator,

‎lib/matplotlib/tests/test_api.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_api.py
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@ def f(cls):
3434
a.f
3535

3636

37+
def test_delete_parameter():
38+
@_api.delete_parameter("3.0", "foo")
39+
def func1(foo=None):
40+
pass
41+
42+
@_api.delete_parameter("3.0", "foo")
43+
def func2(**kwargs):
44+
pass
45+
46+
for func in [func1, func2]:
47+
func() # No warning.
48+
with pytest.warns(_api.MatplotlibDeprecationWarning):
49+
func(foo="bar")
50+
51+
def pyplot_wrapper(foo=_api.deprecation._deprecated_parameter):
52+
func1(foo)
53+
54+
pyplot_wrapper() # No warning.
55+
with pytest.warns(_api.MatplotlibDeprecationWarning):
56+
func(foo="bar")
57+
58+
3759
def test_make_keyword_only():
3860
@_api.make_keyword_only("3.0", "arg")
3961
def func(pre, arg, post=None):

0 commit comments

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