Skip to content

Commit 543b07f

Browse files
committed
Expire parameter renaming and deletion and attribute privatization from 3.5
1 parent 9f17f3f commit 543b07f

17 files changed

+38
-181
lines changed

lib/matplotlib/axes/_base.py

-1
Original file line numberDiff line numberDiff line change
@@ -3195,7 +3195,6 @@ def set_axisbelow(self, b):
31953195
self.stale = True
31963196

31973197
@_docstring.dedent_interpd
3198-
@_api.rename_parameter("3.5", "b", "visible")
31993198
def grid(self, visible=None, which='major', axis='both', **kwargs):
32003199
"""
32013200
Configure the grid lines.

lib/matplotlib/axis.py

-1
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,6 @@ def get_minor_ticks(self, numticks=None):
15531553

15541554
return self.minorTicks[:numticks]
15551555

1556-
@_api.rename_parameter("3.5", "b", "visible")
15571556
def grid(self, visible=None, which='major', **kwargs):
15581557
"""
15591558
Configure the grid lines.

lib/matplotlib/backends/backend_agg.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,7 @@ def buffer_rgba(self):
449449
"""
450450
return self.renderer.buffer_rgba()
451451

452-
@_api.delete_parameter("3.5", "args")
453-
def print_raw(self, filename_or_obj, *args):
452+
def print_raw(self, filename_or_obj):
454453
FigureCanvasAgg.draw(self)
455454
renderer = self.get_renderer()
456455
with cbook.open_file_cm(filename_or_obj, "wb") as fh:
@@ -468,8 +467,7 @@ def _print_pil(self, filename_or_obj, fmt, pil_kwargs, metadata=None):
468467
filename_or_obj, self.buffer_rgba(), format=fmt, origin="upper",
469468
dpi=self.figure.dpi, metadata=metadata, pil_kwargs=pil_kwargs)
470469

471-
@_api.delete_parameter("3.5", "args")
472-
def print_png(self, filename_or_obj, *args,
470+
def print_png(self, filename_or_obj,
473471
metadata=None, pil_kwargs=None):
474472
"""
475473
Write the figure to a PNG file.
@@ -529,8 +527,7 @@ def print_to_buffer(self):
529527
# print_figure(), and the latter ensures that `self.figure.dpi` already
530528
# matches the dpi kwarg (if any).
531529

532-
@_api.delete_parameter("3.5", "args")
533-
def print_jpg(self, filename_or_obj, *args, pil_kwargs=None):
530+
def print_jpg(self, filename_or_obj, pil_kwargs=None):
534531
# savefig() has already applied savefig.facecolor; we now set it to
535532
# white to make imsave() blend semi-transparent figures against an
536533
# assumed white background.

lib/matplotlib/backends/backend_ps.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -828,11 +828,9 @@ class FigureCanvasPS(FigureCanvasBase):
828828
def get_default_filetype(self):
829829
return 'ps'
830830

831-
@_api.delete_parameter("3.5", "args")
832831
def _print_ps(
833-
self, fmt, outfile, *args,
834-
metadata=None, papertype=None, orientation='portrait',
835-
**kwargs):
832+
self, fmt, outfile, metadata=None, papertype=None,
833+
orientation='portrait', **kwargs):
836834

837835
dpi = self.figure.dpi
838836
self.figure.dpi = 72 # Override the dpi kwarg

lib/matplotlib/backends/backend_svg.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1314,8 +1314,7 @@ class FigureCanvasSVG(FigureCanvasBase):
13141314

13151315
fixed_dpi = 72
13161316

1317-
@_api.delete_parameter("3.5", "args")
1318-
def print_svg(self, filename, *args, bbox_inches_restore=None,
1317+
def print_svg(self, filename, bbox_inches_restore=None,
13191318
metadata=None):
13201319
"""
13211320
Parameters
@@ -1362,8 +1361,7 @@ def print_svg(self, filename, *args, bbox_inches_restore=None,
13621361
self.figure.draw(renderer)
13631362
renderer.finalize()
13641363

1365-
@_api.delete_parameter("3.5", "args")
1366-
def print_svgz(self, filename, *args, **kwargs):
1364+
def print_svgz(self, filename, **kwargs):
13671365
with cbook.open_file_cm(filename, "wb") as fh, \
13681366
gzip.GzipFile(mode='w', fileobj=fh) as gzipwriter:
13691367
return self.print_svg(gzipwriter, **kwargs)

lib/matplotlib/backends/backend_template.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ def draw(self):
197197
# you should add it to the class-scope filetypes dictionary as follows:
198198
filetypes = {**FigureCanvasBase.filetypes, 'foo': 'My magic Foo format'}
199199

200-
@_api.delete_parameter("3.5", "args")
201-
def print_foo(self, filename, *args, **kwargs):
200+
def print_foo(self, filename, **kwargs):
202201
"""
203202
Write out format foo.
204203

lib/matplotlib/backends/backend_webagg_core.py

-2
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,6 @@ class NavigationToolbar2WebAgg(backend_bases.NavigationToolbar2):
389389
if name_of_method in _ALLOWED_TOOL_ITEMS
390390
]
391391

392-
cursor = _api.deprecate_privatize_attribute("3.5")
393-
394392
def __init__(self, canvas):
395393
self.message = ''
396394
self._cursor = None # Remove with deprecation.

lib/matplotlib/colorbar.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,6 @@ def __init__(self, ax, mappable=None, *, cmap=None,
353353
for spine in self.ax.spines.values():
354354
spine.set_visible(False)
355355
self.outline = self.ax.spines['outline'] = _ColorbarSpine(self.ax)
356-
# Only kept for backcompat; remove after deprecation of .patch elapses.
357-
self._patch = mpatches.Polygon(
358-
np.empty((0, 2)),
359-
color=mpl.rcParams['axes.facecolor'], linewidth=0.01, zorder=-1)
360-
ax.add_artist(self._patch)
361356

362357
self.dividers = collections.LineCollection(
363358
[],
@@ -466,9 +461,6 @@ def _cbar_cla(self):
466461
del self.ax.cla
467462
self.ax.cla()
468463

469-
# Also remove ._patch after deprecation elapses.
470-
patch = _api.deprecate_privatize_attribute("3.5", alternative="ax")
471-
472464
filled = _api.deprecate_privatize_attribute("3.6")
473465

474466
def update_normal(self, mappable):
@@ -849,8 +841,7 @@ def _get_ticker_locator_formatter(self):
849841
self._minorlocator = minorlocator
850842
_log.debug('locator: %r', locator)
851843

852-
@_api.delete_parameter("3.5", "update_ticks")
853-
def set_ticks(self, ticks, update_ticks=True, labels=None, *,
844+
def set_ticks(self, ticks, labels=None, *,
854845
minor=False, **kwargs):
855846
"""
856847
Set tick locations.
@@ -890,8 +881,7 @@ def get_ticks(self, minor=False):
890881
else:
891882
return self._long_axis().get_majorticklocs()
892883

893-
@_api.delete_parameter("3.5", "update_ticks")
894-
def set_ticklabels(self, ticklabels, update_ticks=True, *, minor=False,
884+
def set_ticklabels(self, ticklabels, *, minor=False,
895885
**kwargs):
896886
"""
897887
[*Discouraged*] Set tick labels.

lib/matplotlib/dviread.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,7 @@ def search(self, filename):
10281028

10291029

10301030
@lru_cache()
1031-
@_api.delete_parameter("3.5", "format")
1032-
def _find_tex_file(filename, format=None):
1031+
def _find_tex_file(filename):
10331032
"""
10341033
Find a file in the texmf tree using kpathsea_.
10351034
@@ -1057,15 +1056,13 @@ def _find_tex_file(filename, format=None):
10571056
# out of caution
10581057
if isinstance(filename, bytes):
10591058
filename = filename.decode('utf-8', errors='replace')
1060-
if isinstance(format, bytes):
1061-
format = format.decode('utf-8', errors='replace')
10621059

10631060
try:
10641061
lk = _LuatexKpsewhich()
10651062
except FileNotFoundError:
10661063
lk = None # Fallback to directly calling kpsewhich, as below.
10671064

1068-
if lk and format is None:
1065+
if lk:
10691066
path = lk.search(filename)
10701067

10711068
else:
@@ -1079,10 +1076,7 @@ def _find_tex_file(filename, format=None):
10791076
kwargs = {'encoding': sys.getfilesystemencoding(),
10801077
'errors': 'surrogateescape'}
10811078

1082-
cmd = ['kpsewhich']
1083-
if format is not None:
1084-
cmd += ['--format=' + format]
1085-
cmd += [filename]
1079+
cmd = ['kpsewhich', filename]
10861080
try:
10871081
path = (cbook._check_and_log_subprocess(cmd, _log, **kwargs)
10881082
.rstrip('\n'))
@@ -1099,11 +1093,9 @@ def _find_tex_file(filename, format=None):
10991093

11001094
# After the deprecation period elapses, delete this shim and rename
11011095
# _find_tex_file to find_tex_file everywhere.
1102-
@_api.delete_parameter("3.5", "format")
1103-
def find_tex_file(filename, format=None):
1096+
def find_tex_file(filename):
11041097
try:
1105-
return (_find_tex_file(filename, format) if format is not None else
1106-
_find_tex_file(filename))
1098+
return _find_tex_file(filename)
11071099
except FileNotFoundError as exc:
11081100
_api.warn_deprecated(
11091101
"3.6", message=f"{exc.args[0]}; in the future, this will raise a "

lib/matplotlib/figure.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,21 @@ def __init__(self, left=None, bottom=None, right=None, top=None,
121121
The height of the padding between subplots,
122122
as a fraction of the average Axes height.
123123
"""
124-
self._validate = True
125124
for key in ["left", "bottom", "right", "top", "wspace", "hspace"]:
126125
setattr(self, key, mpl.rcParams[f"figure.subplot.{key}"])
127126
self.update(left, bottom, right, top, wspace, hspace)
128127

129-
# Also remove _validate after deprecation elapses.
130-
validate = _api.deprecate_privatize_attribute("3.5")
131-
132128
def update(self, left=None, bottom=None, right=None, top=None,
133129
wspace=None, hspace=None):
134130
"""
135131
Update the dimensions of the passed parameters. *None* means unchanged.
136132
"""
137-
if self._validate:
138-
if ((left if left is not None else self.left)
139-
>= (right if right is not None else self.right)):
140-
raise ValueError('left cannot be >= right')
141-
if ((bottom if bottom is not None else self.bottom)
142-
>= (top if top is not None else self.top)):
143-
raise ValueError('bottom cannot be >= top')
133+
if ((left if left is not None else self.left)
134+
>= (right if right is not None else self.right)):
135+
raise ValueError('left cannot be >= right')
136+
if ((bottom if bottom is not None else self.bottom)
137+
>= (top if top is not None else self.top)):
138+
raise ValueError('bottom cannot be >= top')
144139
if left is not None:
145140
self.left = left
146141
if right is not None:

lib/matplotlib/patches.py

+3-20
Original file line numberDiff line numberDiff line change
@@ -3853,11 +3853,8 @@ def __str__(self):
38533853

38543854
@_docstring.dedent_interpd
38553855
@_api.make_keyword_only("3.6", name="mutation_scale")
3856-
@_api.delete_parameter("3.4", "bbox_transmuter", alternative="boxstyle")
3857-
def __init__(self, xy, width, height,
3858-
boxstyle="round", bbox_transmuter=None,
3859-
mutation_scale=1, mutation_aspect=1,
3860-
**kwargs):
3856+
def __init__(self, xy, width, height, boxstyle="round", mutation_scale=1,
3857+
mutation_aspect=1, **kwargs):
38613858
"""
38623859
Parameters
38633860
----------
@@ -3905,17 +3902,7 @@ def __init__(self, xy, width, height,
39053902
self._width = width
39063903
self._height = height
39073904

3908-
if boxstyle == "custom":
3909-
_api.warn_deprecated(
3910-
"3.4", message="Support for boxstyle='custom' is deprecated "
3911-
"since %(since)s and will be removed %(removal)s; directly "
3912-
"pass a boxstyle instance as the boxstyle parameter instead.")
3913-
if bbox_transmuter is None:
3914-
raise ValueError("bbox_transmuter argument is needed with "
3915-
"custom boxstyle")
3916-
self._bbox_transmuter = bbox_transmuter
3917-
else:
3918-
self.set_boxstyle(boxstyle)
3905+
self.set_boxstyle(boxstyle)
39193906

39203907
self._mutation_scale = mutation_scale
39213908
self._mutation_aspect = mutation_aspect
@@ -4436,10 +4423,6 @@ def _get_path_in_displaycoord(self):
44364423

44374424
return _path, fillable
44384425

4439-
get_path_in_displaycoord = _api.deprecate_privatize_attribute(
4440-
"3.5",
4441-
alternative="self.get_transform().transform_path(self.get_path())")
4442-
44434426
def draw(self, renderer):
44444427
if not self.get_visible():
44454428
return

lib/matplotlib/texmanager.py

-5
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ class TexManager:
100100
'computer modern typewriter': 'monospace',
101101
}
102102

103-
grey_arrayd = _api.deprecate_privatize_attribute("3.5")
104-
font_family = _api.deprecate_privatize_attribute("3.5")
105-
font_families = _api.deprecate_privatize_attribute("3.5")
106-
font_info = _api.deprecate_privatize_attribute("3.5")
107-
108103
@functools.lru_cache() # Always return the same instance.
109104
def __new__(cls):
110105
Path(cls.texcache).mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)