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)
| 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] |
no outgoing calls