diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index cc1f3802a02f..8aabe16769b7 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1311,7 +1311,7 @@ def set_adjustable(self, adjustable, share=False): """ if adjustable == 'box-forced': cbook.warn_deprecated( - "2.2", "box-forced", obj_type="keyword argument") + "2.2", name="box-forced", obj_type="keyword argument") if adjustable not in ('box', 'datalim', 'box-forced'): raise ValueError("argument must be 'box', or 'datalim'") if share: @@ -1641,8 +1641,8 @@ def axis(self, *v, **kwargs): 'auto', 'image', 'square'): if s == 'normal': cbook.warn_deprecated( - "3.1", "Passing 'normal' to axis() is deprecated " - "since %(since)s; use 'auto' instead.") + "3.1", message="Passing 'normal' to axis() is " + "deprecated since %(since)s; use 'auto' instead.") self.set_autoscale_on(True) self.set_aspect('auto') self.autoscale_view(tight=False) diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 4f174b0da45e..31ec36f8e86e 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -1637,9 +1637,9 @@ def set_ticklabels(self, ticklabels, *args, minor=False, **kwargs): """ if args: cbook.warn_deprecated( - "3.1", "Additional positional arguments to set_ticklabels are " - "ignored, and deprecated since Matplotlib 3.1; passing them " - "will raise a TypeError in Matplotlib 3.3.") + "3.1", message="Additional positional arguments to " + "set_ticklabels are ignored, and deprecated since Matplotlib " + "3.1; passing them will raise a TypeError in Matplotlib 3.3.") get_labels = [] for t in ticklabels: # try calling get_text() to check whether it is Text object diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index 8323d7e67373..1d2f1176df1b 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -420,9 +420,9 @@ def _string_to_bool(s): """Parses the string argument as a boolean""" if not isinstance(s, str): return bool(s) - warn_deprecated("2.2", "Passing one of 'on', 'true', 'off', 'false' as a " - "boolean is deprecated; use an actual boolean " - "(True/False) instead.") + warn_deprecated("2.2", message="Passing one of 'on', 'true', 'off', " + "'false' as a boolean is deprecated; use an actual " + "boolean (True/False) instead.") if s.lower() in ['on', 'true']: return True if s.lower() in ['off', 'false']: diff --git a/lib/matplotlib/cbook/deprecation.py b/lib/matplotlib/cbook/deprecation.py index 2c0b3d5e897e..73a5fd6d757e 100644 --- a/lib/matplotlib/cbook/deprecation.py +++ b/lib/matplotlib/cbook/deprecation.py @@ -176,9 +176,9 @@ def the_function_to_deprecate(): if obj_type is not None: warn_deprecated( - "3.0", "Passing 'obj_type' to the 'deprecated' decorator has no " - "effect, and is deprecated since Matplotlib %(since)s; support " - "for it will be removed %(removal)s.") + "3.0", message="Passing 'obj_type' to the 'deprecated' decorator " + "has no effect, and is deprecated since Matplotlib %(since)s; " + "support for it will be removed %(removal)s.") def deprecate(obj, message=message, name=name, alternative=alternative, pending=pending, addendum=addendum): diff --git a/lib/matplotlib/gridspec.py b/lib/matplotlib/gridspec.py index 8964657b049d..222c67d66a17 100644 --- a/lib/matplotlib/gridspec.py +++ b/lib/matplotlib/gridspec.py @@ -290,7 +290,8 @@ def get_subplot_params(self, figure=None, fig=None): parameters are from rcParams unless a figure attribute is set. """ if fig is not None: - cbook.warn_deprecated("2.2", "fig", obj_type="keyword argument", + cbook.warn_deprecated("2.2", name="fig", + obj_type="keyword argument", alternative="figure") if figure is None: figure = fig @@ -382,7 +383,8 @@ def get_subplot_params(self, figure=None, fig=None): """Return a dictionary of subplot layout parameters. """ if fig is not None: - cbook.warn_deprecated("2.2", "fig", obj_type="keyword argument", + cbook.warn_deprecated("2.2", name="fig", + obj_type="keyword argument", alternative="figure") if figure is None: figure = fig diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index c6c5b50a07c8..8004bee3c247 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1243,9 +1243,10 @@ def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs): badkwargs = {'ha', 'horizontalalignment', 'va', 'verticalalignment'} if badkwargs & set(prop): cbook.warn_deprecated( - "3.1", "Mixing horizontalalignment or verticalalignment with " - "AnchoredText is not supported, deprecated since %(version)s, " - "and will raise an exception %(removal)s.") + "3.1", message="Mixing horizontalalignment or " + "verticalalignment with AnchoredText is not supported, " + "deprecated since %(version)s, and will raise an exception " + "%(removal)s.") self.txt = TextArea(s, textprops=prop, minimumdescent=False) fp = self.txt._text.get_fontproperties() diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 488d4304edd1..761c91cbb2b5 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -616,7 +616,7 @@ def validate_svg_fonttype(s): return s if s == "svgfont": cbook.warn_deprecated( - "2.2", "'svgfont' support for svg.fonttype is deprecated.") + "2.2", message="'svgfont' support for svg.fonttype is deprecated.") return s raise ValueError("Unrecognized svg.fonttype string '{}'; " "valid strings are 'none', 'path'") diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index 4073be9fb064..befda5b2efc9 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -1662,9 +1662,10 @@ def plot_surface(self, X, Y, Z, *args, norm=None, vmin=None, if shade is None: cbook.warn_deprecated( "3.1", - "Passing shade=None to Axes3D.plot_surface() is deprecated " - "since matplotlib 3.1 and will change its semantic or raise " - "an error in matplotlib 3.3. Please use shade=False instead.") + message="Passing shade=None to Axes3D.plot_surface() is " + "deprecated since matplotlib 3.1 and will change its " + "semantic or raise an error in matplotlib 3.3. " + "Please use shade=False instead.") # evenly spaced, and including both endpoints row_inds = list(range(0, rows-1, rstride)) + [rows-1]