MCPcopy
hub / github.com/AstrBotDevs/AstrBot / load_yaml_metadata

Function load_yaml_metadata

astrbot/cli/utils/plugin.py:116–132  ·  view source on GitHub ↗

Load plugin metadata from metadata.yaml file Args: plugin_dir: Plugin directory path Returns: dict: Dictionary containing metadata, or empty dict if loading fails

(plugin_dir: Path)

Source from the content-addressed store, hash-verified

114
115
116def load_yaml_metadata(plugin_dir: Path) -> dict:
117 """Load plugin metadata from metadata.yaml file
118
119 Args:
120 plugin_dir: Plugin directory path
121
122 Returns:
123 dict: Dictionary containing metadata, or empty dict if loading fails
124
125 """
126 yaml_path = plugin_dir / "metadata.yaml"
127 if yaml_path.exists():
128 try:
129 return yaml.safe_load(yaml_path.read_text(encoding="utf-8")) or {}
130 except Exception as e:
131 click.echo(f"Failed to read {yaml_path}: {e}", err=True)
132 return {}
133
134
135def build_plug_list(plugins_dir: Path) -> list:

Callers 2

build_plug_listFunction · 0.85
install_local_pluginFunction · 0.85

Calls 1

read_textMethod · 0.45

Tested by

no test coverage detected