MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_tool

Method get_tool

lib/matplotlib/backend_managers.py:360–387  ·  view source on GitHub ↗

Return the tool object with the given name. For convenience, this passes tool objects through. Parameters ---------- name : str or `.ToolBase` Name of the tool, or the tool itself. warn : bool, default: True Whether a warning

(self, name, warn=True)

Source from the content-addressed store, hash-verified

358 return self._tools
359
360 def get_tool(self, name, warn=True):
361 """
362 Return the tool object with the given name.
363
364 For convenience, this passes tool objects through.
365
366 Parameters
367 ----------
368 name : str or `.ToolBase`
369 Name of the tool, or the tool itself.
370 warn : bool, default: True
371 Whether a warning should be emitted it no tool with the given name
372 exists.
373
374 Returns
375 -------
376 `.ToolBase` or None
377 The tool or None if no tool with the given name exists.
378 """
379 if (isinstance(name, backend_tools.ToolBase)
380 and name.name in self._tools):
381 return name
382 if name not in self._tools:
383 if warn:
384 _api.warn_external(
385 f"ToolManager does not control tool {name!r}")
386 return None
387 return self._tools[name]

Callers 9

remove_toolMethod · 0.95
trigger_toolMethod · 0.95
triggerMethod · 0.80
triggerMethod · 0.80
scroll_zoomMethod · 0.80
_releaseMethod · 0.80
_releaseMethod · 0.80
add_toolMethod · 0.80

Calls

no outgoing calls

Tested by 1