MCPcopy
hub / github.com/cft0808/edict / read_json

Function read_json

scripts/utils.py:11–16  ·  view source on GitHub ↗

安全读取 JSON 文件,失败返回 default

(path, default=None)

Source from the content-addressed store, hash-verified

9
10
11def read_json(path, default=None):
12 """安全读取 JSON 文件,失败返回 default"""
13 try:
14 return json.loads(pathlib.Path(path).read_text(encoding='utf-8'))
15 except Exception:
16 return default if default is not None else {}
17
18
19def get_openclaw_home() -> pathlib.Path:

Callers 7

mainFunction · 0.90
read_skill_contentFunction · 0.90
add_remote_skillFunction · 0.90
push_notificationFunction · 0.90
_do_dispatchFunction · 0.90
do_GETMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected