Skip to content

Commit 981040d

Browse files
committed
Remove ToolManager API deprecated in 3.3.
1 parent 3665cdd commit 981040d

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
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
@@ -83,3 +83,9 @@ and ``funchspace`` methods of `.widgets.SubplotTool` have been removed.
8383
The ``axleft``, ``axright``, ``axbottom``, ``axtop``, ``axwspace``, and
8484
``axhspace`` attributes of `.widgets.SubplotTool` have been removed. Access
8585
the ``ax`` attribute of the corresponding slider, if needed.
86+
87+
Variants on ``ToolManager.update_keymap`` calls
88+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89+
Passing multiple keys as a single comma-separated string or multiple arguments
90+
to `.ToolManager.update_keymap` is no longer supported; pass keys as a list of
91+
strings instead.

lib/matplotlib/backend_managers.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ def _remove_keys(self, name):
175175
for k in self.get_tool_keymap(name):
176176
del self._keys[k]
177177

178-
@_api.delete_parameter("3.3", "args")
179-
def update_keymap(self, name, key, *args):
178+
def update_keymap(self, name, key):
180179
"""
181180
Set the keymap to associate with the specified tool.
182181
@@ -188,23 +187,15 @@ def update_keymap(self, name, key, *args):
188187
Keys to associate with the tool.
189188
"""
190189
if name not in self._tools:
191-
raise KeyError('%s not in Tools' % name)
190+
raise KeyError(f'{name} not in Tools')
192191
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
192+
if isinstance(key, str):
193+
key = [key]
194+
for k in key:
195+
if k in self._keys:
196+
_api.warn_external(
197+
f'Key {k} changed from {self._keys[k]} to {name}')
198+
self._keys[k] = name
208199

209200
def remove_tool(self, name):
210201
"""

0 commit comments

Comments
 (0)