Registers a new plugin. Args: plugin: The plugin instance to register. Raises: ValueError: If a plugin with the same name is already registered.
(self, plugin: BasePlugin)
| 105 | self._skip_closing_plugins = value |
| 106 | |
| 107 | def register_plugin(self, plugin: BasePlugin) -> None: |
| 108 | """Registers a new plugin. |
| 109 | |
| 110 | Args: |
| 111 | plugin: The plugin instance to register. |
| 112 | |
| 113 | Raises: |
| 114 | ValueError: If a plugin with the same name is already registered. |
| 115 | """ |
| 116 | if any(p.name == plugin.name for p in self.plugins): |
| 117 | raise ValueError(f"Plugin with name '{plugin.name}' already registered.") |
| 118 | self.plugins.append(plugin) |
| 119 | logger.info("Plugin '%s' registered.", plugin.name) |
| 120 | |
| 121 | def get_plugin(self, plugin_name: str) -> Optional[BasePlugin]: |
| 122 | """Retrieves a registered plugin by its name. |