8000 Merge pull request #17242 from QuLogic/explicit-deprecations · matplotlib/matplotlib@9575c76 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9575c76

Browse files
authored
Merge pull request #17242 from QuLogic/explicit-deprecations
DOC: Make deprecations versions explicit
2 parents 99ba9f9 + 6941be0 commit 9575c76

File tree

13 files changed

+50
-38
lines changed

13 files changed

+50
-38
lines changed

lib/matplotlib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ def get_data_path(*, _from_rc=None):
515515
cbook.warn_deprecated(
516516
"3.2",
517517
message=("Setting the datapath via matplotlibrc is deprecated "
518-
"%(since)s and will be rem 8000 oved in %(removal)s."),
519-
removal='3.3')
518+
"%(since)s and will be removed %(removal)s."),
519+
removal='3.4')
520520
path = Path(_from_rc)
521521
if path.is_dir():
522522
defaultParams['datapath'][0] = str(path)

lib/matplotlib/axes/_axes.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5206,9 +5206,9 @@ def _fill_between_x_or_y(
52065206
where = np.asarray(where, dtype=bool)
52075207
if where.size != ind.size:
52085208
cbook.warn_deprecated(
5209-
"3.2", message=f"The parameter where must have the same "
5210-
f"size as {ind} in {func_name}(). This will become an "
5211-
"error in future versions of Matplotlib.")
5209+
"3.2", message=f"Since %(since)s, the parameter *where* "
5210+
f"must have the same size as {ind} in {func_name}(). This "
5211+
"will become an error %(removal)s.")
52125212
where = where & ~functools.reduce(
52135213
np.logical_or, map(np.ma.getmask, [ind, dep1, dep2]))
52145214

@@ -5592,7 +5592,8 @@ def _pcolorargs(funcname, *args, shading='flat'):
55925592
"dimensions as C is deprecated since %(since)s. Either "
55935593
"specify the corners of the quadrilaterals with X and Y, "
55945594
"or pass shading='auto', 'nearest' or 'gouraud', or set "
5595-
"rcParams['pcolor.shading']")
5595+
"rcParams['pcolor.shading']. This will become an error "
5596+
"%(removal)s.")
55965597
C = C[:Ny - 1, :Nx - 1]
55975598
else: # ['nearest', 'gouraud']:
55985599
if (Nx, Ny) != (ncols, nrows):

lib/matplotlib/axes/_subplots.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ def subplot_class_factory(axes_class=None):
188188
if axes_class is None:
189189
cbook.warn_deprecated(
190190
"3.3", message="Support for passing None to subplot_class_factory "
191-
"is deprecated; explicitly pass the default Axes class instead.")
191+
"is deprecated since %(since)s; explicitly pass the default Axes "
192+
"class instead. This will become an error %(removal)s.")
192193
axes_class = Axes
193194
try:
194195
# Avoid creating two different instances of GeoAxesSubplot...

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,8 +1848,10 @@ def enter_notify_event(self, guiEvent=None, xy=None):
18481848
x = None
18491849
y = None
18501850
cbook.warn_deprecated(
1851-
'3.0', message='enter_notify_event expects a location but '
1852-
'your backend did not pass one.')
1851+
'3.0', removal='3.5', name='enter_notify_event',
1852+
message='Since %(since)s, %(name)s expects a location but '
1853+
'your backend did not pass one. This will become an error '
1854+
'%(removal)s.')
18531855

18541856
event = LocationEvent('figure_enter_event', self, x, y, guiEvent)
18551857
self.callbacks.process('figure_enter_event', event)

lib/matplotlib/cm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ def register_cmap(name=None, cmap=None, data=None, lut=None):
163163
cbook.warn_deprecated(
164164
"3.3",
165165
message="Passing raw data via parameters data and lut to "
166-
"register_cmap() is deprecated. Instead use: "
167-
"register_cmap("
166+
"register_cmap() is deprecated since %(since)s and will "
167+
"become an error %(removal)s. Instead use: register_cmap("
168168
"cmap=LinearSegmentedColormap(name, data, lut))")
169169
# For the remainder, let exceptions propagate.
170170
if lut is None:
@@ -255,7 +255,8 @@ def _scale_norm(self, norm, vmin, vmax):
255255
cbook.warn_deprecated(
256256
"3.3",
257257
message="Passing parameters norm and vmin/vmax "
258-
"simultaneously is deprecated. Please pass "
258+
"simultaneously is deprecated since %(since)s and "
259+
"will become an error %(removal)s. Please pass "
259260
"vmin/vmax directly to the norm when creating it.")
260261
else:
261262
self.autoscale_None()

lib/matplotlib/colors.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,10 @@ def to_rgba_array(c, alpha=None):
315315
"consisting of single character color specifiers such as "
316316
"'rgb'. Note also that the latter is deprecated." % c) from err
317317
else:
318-
cbook.warn_deprecated("3.2", message="Using a string of single "
319-
"character colors as a color sequence is "
320-
"deprecated. Use an explicit list instead.")
318+
cbook.warn_deprecated(
319+
"3.2", message="Using a string of single character colors as "
320+
"a color sequence is deprecated since %(since)s and will be "
321+
"removed %(removal)s. Use an explicit list instead.")
321322
return result
322323

323324
if len(c) == 0:
@@ -1265,8 +1266,9 @@ def __init__(self, linthresh, linscale=1.0, vmin=None, vmax=None,
12651266
if base is None:
12661267
self._base = np.e
12671268
cbook.warn_deprecated(
1268-
"3.3", message="default base will change from np.e to 10. To "
1269-
"suppress this warning specify the base kwarg.")
1269+
"3.2", removal="3.4", message="default base will change from "
1270+
"np.e to 10 %(removal)s. To suppress this warning specify "
1271+
"the base keyword argument.")
12701272
else:
12711273
self._base = base
12721274
self._log_base = np.log(self._base)

lib/matplotlib/figure.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,8 +1208,8 @@ def add_axes(self, *args, **kwargs):
12081208
cbook.warn_deprecated(
12091209
"3.3",
12101210
message="Calling add_axes() without argument is "
1211-
"deprecated. You may want to use add_subplot() "
1212-
"instead.")
1211+
"deprecated since %(since)s and will be removed %(removal)s. "
1212+
"You may want to use add_subplot() instead.")
12131213
return
12141214
elif 'rect' in kwargs:
12151215
if len(args):
@@ -1382,7 +1382,8 @@ def add_subplot(self, *args, **kwargs):
13821382
cbook.warn_deprecated(
13831383
"3.3",
13841384
message="Passing non-integers as three-element "
1385-
"position specification is deprecated.")
1385+
"position specification is deprecated since "
1386+
"%(since)s and will be removed %(removal)s.")
13861387
args = tuple(map(int, args))
13871388
else:
13881389
raise TypeError(f'add_subplot() takes 1 or 3 positional arguments '

lib/matplotlib/lines.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ def set_picker(self, p):
598598
# After deprecation, the whole method can be deleted and inherited.
599599
cbook.warn_deprecated(
600600
"3.3", message="Setting the line's pick radius via set_picker "
601-
"is deprecated; use set_pickradius instead.")
601+
"is deprecated since %(since)s and will be removed "
602+
"%(removal)s; use set_pickradius instead.")
602603
self.pickradius = p
603604
self._picker = p
604605

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ def validate_axisbelow(s):
201201
cbook.warn_deprecated(
202202
"3.3", message=f"Support for setting axes.axisbelow to "
203203
f"{s!r} to mean 'line' is deprecated since %(since)s and "
204-
f"will be removed in %(removal)s; set it to 'line' "
205-
"instead.")
204+
f"will be removed %(removal)s; set it to 'line' instead.")
206205
return 'line'
207206
raise ValueError('%s cannot be interpreted as'
208207
' True, False, or "line"' % s)

lib/matplotlib/scale.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def __init__(self, axis, **kwargs):
5656
"""
5757
if kwargs:
5858
warn_deprecated(
59-
'3.2.0',
59+
'3.2', removal='3.4',
6060
message=(
61-
f"ScaleBase got an unexpected keyword "
62-
f"argument {next(iter(kwargs))!r}. "
63-
'In the future this will raise TypeError')
61+
f"ScaleBase got an unexpected keyword argument "
62+
f"{next(iter(kwargs))!r}. This will become an error "
63+
"%(removal)s.")
6464
)
6565

6666
def get_transform(self):
@@ -483,11 +483,11 @@ def __init__(self, axis, **kwargs):
483483
def __init__(*, base=10, linthresh=2, subs=None, linscale=1, **kwargs):
484484
if kwargs:
485485
warn_deprecated(
486-
"3.2.0",
486+
'3.2', removal='3.4',
487487
message=(
488488
f"SymmetricalLogScale got an unexpected keyword "
489-
f"argument {next(iter(kwargs))!r}; in the future, "
490-
f"this will raise a TypeError")
489+
f"argument {next(iter(kwargs))!r}. This will become "
490+
"an error %(removal)s.")
491491
)
492492
return base, linthresh, subs, linscale
493493

lib/matplotlib/streamplot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ def __init__(self, lines, arrows, **kwargs):
237237
cbook.warn_deprecated(
238238
"3.3",
239239
message="Passing arbitrary keyword arguments to StreamplotSet "
240-
"is deprecated.")
240+
"is deprecated since %(since) and will become an "
241+
"error %(removal)s.")
241242
self.lines = lines
242243
self.arrows = arrows
243244

lib/mpl_toolkits/axes_grid1/parasite_axes.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ def parasite_axes_class_factory(axes_class=None):
5454
if axes_class is None:
5555
cbook.warn_deprecated(
5656
"3.3", message="Support for passing None to "
57-
"parasite_axes_class_factory is deprecated; explicitly pass the "
58-
"default Axes class instead.")
57+
"parasite_axes_class_factory is deprecated since %(since)s and "
58+
"will be removed %(removal)s; explicitly pass the default Axes "
59+
"class instead.")
5960
axes_class = Axes
6061

6162
return type("%sParasite" % axes_class.__name__,
@@ -181,8 +182,9 @@ def parasite_axes_auxtrans_class_factory(axes_class=None):
181182
if axes_class is None:
182183
cbook.warn_deprecated(
183184
"3.3", message="Support for passing None to "
184-
"parasite_axes_auxtrans_class_factory is deprecated; explicitly "
185-
"pass the default ParasiteAxes class instead.")
185+
"parasite_axes_auxtrans_class_factory is deprecated since "
186+
"%(since)s and will be removed %(removal)s; explicitly pass the "
187+
"default ParasiteAxes class instead.")
186188
parasite_axes_class = ParasiteAxes
187189
elif not issubclass(axes_class, ParasiteAxesBase):
188190
parasite_axes_class = parasite_axes_class_factory(axes_class)
@@ -363,7 +365,8 @@ def host_axes_class_factory(axes_class=None):
363365
if axes_class is None:
364366
cbook.warn_deprecated(
365367
"3.3", message="Support for passing None to host_axes_class is "
366-
"deprecated; explicitly pass the default Axes class instead.")
368+
"deprecated since %(since)s and will be removed %(removed)s; "
369+
"explicitly pass the default Axes class instead.")
367370
axes_class = Axes
368371

369372
def _get_base_axes(self):

lib/mpl_toolkits/axisartist/grid_finder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def _deprecate_factor_none(factor):
1010
# removed.
1111
if factor is None:
1212
cbook.warn_deprecated(
13-
"3.2",
14-
message="factor=None is deprecated; use/return factor=1 instead")
13+
"3.2", message="factor=None is deprecated since %(since)s and "
14+
"support will be removed %(removal)s; use/return factor=1 instead")
1515
factor = 1
1616
return factor
1717

0 commit comments

Comments
 (0)
0