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 fef6af3

Browse filesBrowse files
authored
Merge pull request #19134 from timhoffm/api-move-functions
MNT: Switch internal API function calls from cbook to _api
2 parents e48622a + 410c51d commit fef6af3
Copy full SHA for fef6af3
Expand file treeCollapse file tree

36 files changed

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

‎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

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
+9-9Lines changed: 9 additions & 9 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, (
@@ -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
@@ -433,14 +433,14 @@ def wrapper(*inner_args, **inner_kwargs):
433433
return wrapper
434434

435435

436-
def _make_keyword_only(since, name, func=None):
436+
def make_keyword_only(since, name, func=None):
437437
"""
438438
Decorator indicating that passing parameter *name* (or any of the following
439439
ones) positionally to *func* is being deprecated.
440440
"""
441441

442442
if func is None:
443-
return functools.partial(_make_keyword_only, since, name)
443+
return functools.partial(make_keyword_only, since, name)
444444

445445
signature = inspect.signature(func)
446446
POK = inspect.Parameter.POSITIONAL_OR_KEYWORD
@@ -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
+2-2Lines changed: 2 additions & 2 deletions
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
@@ -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):
Collapse file

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

‎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.
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/axes/_base.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def __str__(self):
465465
return "{0}({1[0]:g},{1[1]:g};{1[2]:g}x{1[3]:g})".format(
466466
type(self).__name__, self._position.bounds)
467467

468-
@cbook._make_keyword_only("3.4", "facecolor")
468+
@_api.make_keyword_only("3.4", "facecolor")
469469
def __init__(self, fig, rect,
470470
facecolor=None, # defaults to rc axes.facecolor
471471
frameon=True,
@@ -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
Collapse file

‎lib/matplotlib/axis.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+3-3Lines changed: 3 additions & 3 deletions
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,
@@ -1266,7 +1266,7 @@ def get_minorticklocs(self):
12661266
if ~np.isclose(tr_loc, tr_major_locs, atol=tol, rtol=0).any()]
12671267
return minor_locs
12681268

1269-
@cbook._make_keyword_only("3.3", "minor")
1269+
@_api.make_keyword_only("3.3", "minor")
12701270
def get_ticklocs(self, minor=False):
12711271
"""Return this Axis' tick locations in data coordinates."""
12721272
return self.get_minorticklocs() if minor else self.get_majorticklocs()
@@ -1738,7 +1738,7 @@ def set_ticklabels(self, ticklabels, *, minor=False, **kwargs):
17381738

17391739
# Wrapper around set_ticklabels used to generate Axes.set_x/ytickabels; can
17401740
# go away once the API of Axes.set_x/yticklabels becomes consistent.
1741-
@cbook._make_keyword_only("3.3", "fontdict")
1741+
@_api.make_keyword_only("3.3", "fontdict")
17421742
def _set_ticklabels(self, labels, fontdict=None, minor=False, **kwargs):
17431743
"""
17441744
Set this Axis' labels with list of string labels.
Collapse file

‎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
"""

0 commit comments

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