8000 Remove ToolManager API deprecated in 3.3. · matplotlib/matplotlib@b04f1a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit b04f1a3

Browse files
committed
Remove ToolManager API deprecated in 3.3.
1 parent 19da8c3 commit b04f1a3

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

doc/api/next_api_changes/removals/20465-ES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,9 @@ and ``funchspace`` methods of `.widgets.SubplotTool` have been removed.
8585
The ``axleft``, ``axright``, ``axbottom``, ``axtop``, ``axwspace``, and
8686
``axhspace`` attributes of `.widgets.SubplotTool` have been removed. Access
8787
the ``ax`` attribute of the corresponding slider, if needed.
88+
89+
Variants on ``ToolManager.update_keymap`` calls
90+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91+
Passing multiple keys as a single comma-separated string or multiple arguments
92+
to `.ToolManager.update_keymap` is no longer supported; pass keys as a list of
93+
strings instead.

lib/matplotlib/backend_managers.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from matplotlib import _api, cbook, widgets
2-
from matplotlib.rcsetup import validate_stringlist
32
import matplotlib.backend_tools as tools
43

54

@@ -175,8 +174,7 @@ def _remove_keys(self, name):
175174
for k in self.get_tool_keymap(name):
176175
del self._keys[k]
177176

178-
@_api.delete_parameter("3.3", "args")
179-
def update_keymap(self, name, key, *args):
177+
def update_keymap(self, name, key):
180178
"""
181179
Set the keymap to associate with the specified tool.
182180
@@ -188,23 +186,15 @@ def update_keymap(self, name, key, *args):
188186
Keys to associate with the tool.
189187
"""
190188
if name not in self._tools:
191-
raise KeyError('%s not in Tools' % name)
189+
raise KeyError(f'{name} not in Tools')
192190
self._remove_keys(name)
193-
for key in [key, *args]:
194-
if isinstance(key, str) and validate_stringlist(key) != [key]:
195-
_api.warn_deprecated(
196-
"3.3", message="Passing a list of keys as a single "
197-
"comma-separated string is deprecated since %(since)s and "
198-
"support will be removed %(removal)s; pass keys as a list "
199-
"of strings instead.")
200-
key = validate_stringlist(key)
201-
if isinstance(key, str):
202-
key = [key]
203-
for k in key:
204-
if k in self._keys:
205-
_api.warn_external(
206-
f'Key {k} changed from {self._keys[k]} to {name}')
207-
self._keys[k] = name
191+
if isinstance(key, str):
192+
key = [key]
193+
for k in key:
194+
if k in self._keys:
195+
_api.warn_external(
196+
f'Key {k} changed from {self._keys[k]} to {name}')
197+
self._keys[k] = name
208198

209199
def remove_tool(self, name):
210200
"""

0 commit comments

Comments
 (0)
0