From df3834e90d922ff1d36a2b5b2685b41a255dc1a7 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Wed, 11 Sep 2019 10:51:09 +0200 Subject: [PATCH] Fix incorrect calls to warn_deprecated. 1) `message` is keyword-only. 2) it's `%(since)s`, not `%(version)s`. --- lib/matplotlib/backend_bases.py | 10 +++++----- lib/matplotlib/offsetbox.py | 2 +- lib/mpl_toolkits/axisartist/grid_finder.py | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index b64871b4f8a4..967faa1306c5 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1167,11 +1167,11 @@ def remove_callback(self, func, *args, **kwargs): """ if args or kwargs: cbook.warn_deprecated( - "3.1", "In a future version, Timer.remove_callback will not " - "take *args, **kwargs anymore, but remove all callbacks where " - "the callable matches; to keep a specific callback removable " - "by itself, pass it to add_callback as a functools.partial " - "object.") + "3.1", message="In a future version, Timer.remove_callback " + "will not take *args, **kwargs anymore, but remove all " + "callbacks where the callable matches; to keep a specific " + "callback removable by itself, pass it to add_callback as a " + "functools.partial object.") self.callbacks.remove((func, args, kwargs)) else: funcs = [c[0] for c in self.callbacks] diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 5057a93bf894..80e5736ff429 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1308,7 +1308,7 @@ def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs): cbook.warn_deprecated( "3.1", message="Mixing horizontalalignment or " "verticalalignment with AnchoredText is not supported, " - "deprecated since %(version)s, and will raise an exception " + "deprecated since %(since)s, and will raise an exception " "%(removal)s.") self.txt = TextArea(s, textprops=prop, minimumdescent=False) diff --git a/lib/mpl_toolkits/axisartist/grid_finder.py b/lib/mpl_toolkits/axisartist/grid_finder.py index 73ae60be82d5..3a8585c99635 100644 --- a/lib/mpl_toolkits/axisartist/grid_finder.py +++ b/lib/mpl_toolkits/axisartist/grid_finder.py @@ -10,7 +10,8 @@ def _deprecate_factor_none(factor): # removed. if factor is None: cbook.warn_deprecated( - "3.2", "factor=None is deprecated; use/return factor=1 instead") + "3.2", + message="factor=None is deprecated; use/return factor=1 instead") factor = 1 return factor