MCPcopy Index your code
hub / github.com/google/adk-python / _import_plugin_object

Method _import_plugin_object

src/google/adk/cli/api_server.py:779–795  ·  view source on GitHub ↗

Import a plugin object (class or instance) from a fully qualified name. Args: qualified_name: Fully qualified name (e.g., 'my_package.my_plugin.MyPlugin') Returns: The imported object, which can be either a class or an instance. Raises: ImportError: If the mo

(self, qualified_name: str)

Source from the content-addressed store, hash-verified

777 return extra_plugins_instances
778
779 def _import_plugin_object(self, qualified_name: str) -> Any:
780 """Import a plugin object (class or instance) from a fully qualified name.
781
782 Args:
783 qualified_name: Fully qualified name (e.g.,
784 'my_package.my_plugin.MyPlugin')
785
786 Returns:
787 The imported object, which can be either a class or an instance.
788
789 Raises:
790 ImportError: If the module cannot be imported.
791 AttributeError: If the object doesn't exist in the module.
792 """
793 module_name, obj_name = qualified_name.rsplit(".", 1)
794 module = importlib.import_module(module_name)
795 return getattr(module, obj_name)
796
797 def _setup_runtime_config(self, web_assets_dir: str):
798 """Sets up the runtime config for the web server."""

Callers 1

Calls 1

getattrFunction · 0.85

Tested by

no test coverage detected