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 2533114

Browse filesBrowse files
committed
Move internal usage from cbook._rename_parameter to _api.rename_parameter
1 parent a02ffbc commit 2533114
Copy full SHA for 2533114

File tree

Expand file treeCollapse file tree

9 files changed

+28
-28
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

9 files changed

+28
-28
lines changed
Open diff view settings
Collapse file

‎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)
Collapse file

‎lib/matplotlib/_api/deprecation.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/_api/deprecation.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def __set_name__(self, owner, name):
294294
property(lambda self: getattr(self, f"_{name}")), name=name))
295295

296296

297-
def _rename_parameter(since, old, new, func=None):
297+
def rename_parameter(since, old, new, func=None):
298298
"""
299299
Decorator indicating that parameter *old* of *func* is renamed to *new*.
300300
@@ -309,12 +309,12 @@ def _rename_parameter(since, old, new, func=None):
309309
--------
310310
::
311311
312-
@_rename_parameter("3.1", "bad_name", "good_name")
312+
@_api.rename_parameter("3.1", "bad_name", "good_name")
313313
def func(good_name): ...
314314
"""
315315

316316
if func is None:
317-
return functools.partial(_rename_parameter, since, old, new)
317+
return functools.partial(rename_parameter, since, old, new)
318318

319319
signature = inspect.signature(func)
320320
assert old not in signature.parameters, (
@@ -459,7 +459,7 @@ def _make_keyword_only(since, name, func=None):
459459
@functools.wraps(func)
460460
def wrapper(*args, **kwargs):
461461
# Don't use signature.bind here, as it would fail when stacked with
462-
# _rename_parameter and an "old" argument name is passed in
462+
# rename_parameter and an "old" argument name is passed in
463463
# (signature.bind would fail, but the actual call would succeed).
464464
idx = [*func.__signature__.parameters].index(name)
465465
if len(args) > idx:
Collapse file

‎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
@@ -158,7 +158,7 @@ def set_canvas_size(self, w, h, d):
158158
self.mathtext_backend.set_canvas_size(
159159
self.width, self.height, self.depth)
160160

161-
@cbook._rename_parameter("3.4", "facename", "font")
161+
@_api.rename_parameter("3.4", "facename", "font")
162162
def render_glyph(self, ox, oy, font, font_class, sym, fontsize, dpi):
163163
"""
164164
At position (*ox*, *oy*), draw the glyph specified by the remaining
Collapse file

‎lib/matplotlib/axes/_axes.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ def text(self, x, y, s, fontdict=None, **kwargs):
645645
self._add_text(t)
646646
return t
647647

648-
@cbook._rename_parameter("3.3", "s", "text")
648+
@_api.rename_parameter("3.3", "s", "text")
649649
@docstring.dedent_interpd
650650
def annotate(self, text, xy, *args, **kwargs):
651651
a = mtext.Annotation(text, xy, *args, **kwargs)
Collapse file

‎lib/matplotlib/cbook/__init__.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
warn_external as _warn_external, classproperty as _classproperty)
3434
from matplotlib._api.deprecation import (
3535
deprecated, warn_deprecated,
36-
_rename_parameter, _delete_parameter, _make_keyword_only,
36+
_delete_parameter, _make_keyword_only,
3737
_deprecate_method_override, _deprecate_privatize_attribute,
3838
MatplotlibDeprecationWarning, mplDeprecation)
3939

Collapse file

‎lib/matplotlib/pyplot.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373

7474

7575
_code_objs = {
76-
cbook._rename_parameter:
77-
cbook._rename_parameter("", "old", "new", lambda new: None).__code__,
76+
_api.rename_parameter:
77+
_api.rename_parameter("", "old", "new", lambda new: None).__code__,
7878
cbook._make_keyword_only:
7979
cbook._make_keyword_only("", "p", lambda p: None).__code__,
8080
}
@@ -84,9 +84,9 @@ def _copy_docstring_and_deprecators(method, func=None):
8484
if func is None:
8585
return functools.partial(_copy_docstring_and_deprecators, method)
8686
decorators = [docstring.copy(method)]
87-
# Check whether the definition of *method* includes _rename_parameter or
88-
# _make_keyword_only decorators; if so, propagate them to the pyplot
89-
# wrapper as well.
87+
# Check whether the definition of *method* includes @_api.rename_parameter
88+
# or @_api._make_keyword_only decorators; if so, propagate them to the
89+
# pyplot wrapper as well.
9090
while getattr(method, "__wrapped__", None) is not None:
9191
for decorator_maker, code in _code_objs.items():
9292
if method.__code__ is code:
Collapse file

‎lib/matplotlib/scale.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/scale.py
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def set_default_locators_and_formatters(self, axis):
194194
class LogTransform(Transform):
195195
input_dims = output_dims = 1
196196

197-
@cbook._rename_parameter("3.3", "nonpos", "nonpositive")
197+
@_api.rename_parameter("3.3", "nonpos", "nonpositive")
198198
def __init__(self, base, nonpositive='clip'):
199199
super().__init__()
200200
if base <= 0 or base == 1:
@@ -287,9 +287,9 @@ def __init__(self, axis, **kwargs):
287287
# The following is to emit the right warnings depending on the axis
288288
# used, as the *old* kwarg names depended on the axis.
289289
axis_name = getattr(axis, "axis_name", "x")
290-
@cbook._rename_parameter("3.3", f"base{axis_name}", "base")
291-
@cbook._rename_parameter("3.3", f"subs{axis_name}", "subs")
292-
@cbook._rename_parameter("3.3", f"nonpos{axis_name}", "nonpositive")
290+
@_api.rename_parameter("3.3", f"base{axis_name}", "base")
291+
@_api.rename_parameter("3.3", f"subs{axis_name}", "subs")
292+
@_api.rename_parameter("3.3", f"nonpos{axis_name}", "nonpositive")
293293
def __init__(*, base=10, subs=None, nonpositive="clip"):
294294
return base, subs, nonpositive
295295

@@ -466,10 +466,10 @@ def InvertedSymmetricalLogTransform(self):
466466
def __init__(self, axis, **kwargs):
467467
axis_name = getattr(axis, "axis_name", "x")
468468
# See explanation in LogScale.__init__.
469-
@cbook._rename_parameter("3.3", f"base{axis_name}", "base")
470-
@cbook._rename_parameter("3.3", f"linthresh{axis_name}", "linthresh")
471-
@cbook._rename_parameter("3.3", f"subs{axis_name}", "subs")
472-
@cbook._rename_parameter("3.3", f"linscale{axis_name}", "linscale")
469+
@_api.rename_parameter("3.3", f"base{axis_name}", "base")
470+
@_api.rename_parameter("3.3", f"linthresh{axis_name}", "linthresh")
471+
@_api.rename_parameter("3.3", f"subs{axis_name}", "subs")
472+
@_api.rename_parameter("3.3", f"linscale{axis_name}", "linscale")
473473
def __init__(*, base=10, linthresh=2, subs=None, linscale=1):
474474
return base, linthresh, subs, linscale
475475

@@ -497,7 +497,7 @@ def get_transform(self):
497497
class LogitTransform(Transform):
498498
input_dims = output_dims = 1
499499

500-
@cbook._rename_parameter("3.3", "nonpos", "nonpositive")
500+
@_api.rename_parameter("3.3", "nonpos", "nonpositive")
501501
def __init__(self, nonpositive='mask'):
502502
super().__init__()
503503
_api.check_in_list(['mask', 'clip'], nonpositive=nonpositive)
@@ -523,7 +523,7 @@ def __str__(self):
523523
class LogisticTransform(Transform):
524524
input_dims = output_dims = 1
525525

526-
@cbook._rename_parameter("3.3", "nonpos", "nonpositive")
526+
@_api.rename_parameter("3.3", "nonpos", "nonpositive")
527527
def __init__(self, nonpositive='mask'):
528528
super().__init__()
529529
self._nonpositive = nonpositive
@@ -548,7 +548,7 @@ class LogitScale(ScaleBase):
548548
"""
549549
name = 'logit'
550550

551-
@cbook._rename_parameter("3.3", "nonpos", "nonpositive")
551+
@_api.rename_parameter("3.3", "nonpos", "nonpositive")
552552
def __init__(self, axis, nonpositive='mask', *,
553553
one_half=r"\frac{1}{2}", use_overline=False):
554554
r"""
Collapse file

‎lib/matplotlib/tests/test_pyplot.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_pyplot.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def test_pyplot_up_to_date(tmpdir):
3939

4040

4141
def test_copy_docstring_and_deprecators(recwarn):
42-
@mpl.cbook._rename_parameter("(version)", "old", "new")
43-
@mpl.cbook._make_keyword_only("(version)", "kwo")
42+
@mpl._api.rename_parameter("(version)", "old", "new")
43+
@mpl._api.make_keyword_only("(version)", "kwo")
4444
def func(new, kwo=None):
4545
pass
4646

Collapse file

‎lib/mpl_toolkits/axisartist/angle_helper.py‎

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axisartist/angle_helper.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import math
33

4-
from matplotlib import _api, cbook
4+
from matplotlib import _api
55
from mpl_toolkits.axisartist.grid_finder import ExtremeFinderSimple
66

77

@@ -141,7 +141,7 @@ def select_step360(v1, v2, nv, include_last=True, threshold_factor=3600):
141141

142142

143143
class LocatorBase:
144-
@cbook._rename_parameter("3.3", "den", "nbins")
144+
@_api.rename_parameter("3.3", "den", "nbins")
145145
def __init__(self, nbins, include_last=True):
146146
self.nbins = nbins
147147
self._include_last = include_last

0 commit comments

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