MCPcopy
hub / github.com/opentrace/opentrace / load_config

Function load_config

agent/src/opentrace_agent/cli/config.py:44–58  ·  view source on GitHub ↗

Load and return the YAML config at *path*. Returns an empty dict when the file is empty or missing.

(path: Path)

Source from the content-addressed store, hash-verified

42
43
44def load_config(path: Path) -> dict[str, Any]:
45 """Load and return the YAML config at *path*.
46
47 Returns an empty dict when the file is empty or missing.
48 """
49 if not path.exists():
50 return {}
51 text = path.read_text()
52 if not text.strip():
53 return {}
54 try:
55 data = yaml.safe_load(text)
56 except yaml.YAMLError:
57 return {}
58 return data if isinstance(data, dict) else {}
59
60
61def save_config(path: Path, data: dict[str, Any]) -> None:

Callers 10

get_api_tokenFunction · 0.90
config_setFunction · 0.90
config_getFunction · 0.90
config_showFunction · 0.90
loginFunction · 0.90
whoamiFunction · 0.90

Calls

no outgoing calls