mirror of
https://github.com/johndoe6345789/AutoMetabuilder.git
synced 2026-05-06 19:49:38 +00:00
f395031366
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
23 lines
749 B
Python
23 lines
749 B
Python
"""Build tool map from registry entries."""
|
|
from ..loaders.callable_loader import load_callable
|
|
|
|
|
|
def build_tool_map(gh, registry_entries: list) -> dict:
|
|
"""Build tool name to callable map."""
|
|
tool_map = {}
|
|
for entry in registry_entries:
|
|
name = entry.get("name")
|
|
provider = entry.get("provider")
|
|
if not name:
|
|
continue
|
|
if provider == "github":
|
|
method = entry.get("method")
|
|
tool_map[name] = getattr(gh, method) if gh and method else None
|
|
continue
|
|
if provider == "module":
|
|
path = entry.get("callable")
|
|
tool_map[name] = load_callable(path) if path else None
|
|
continue
|
|
tool_map[name] = None
|
|
return tool_map
|