MCPcopy
hub / github.com/MaaEnd/MaaEnd / write_versions_file

Function write_versions_file

tools/setup_workspace.py:288–296  ·  view source on GitHub ↗
(path: Path, versions: dict[str, str])

Source from the content-addressed store, hash-verified

286
287
288def write_versions_file(path: Path, versions: dict[str, str]) -> None:
289 try:
290 path.parent.mkdir(parents=True, exist_ok=True)
291 with open(path, "w", encoding="utf-8") as f:
292 json.dump({"versions": versions}, f, ensure_ascii=False, indent=4)
293 print(Console.ok(t("inf_write_version_file", path=path)))
294 print(Console.info(t("inf_current_versions", versions=versions)))
295 except Exception as e:
296 print(Console.warn(t("wrn_write_version_failed", error=e)))
297
298
299def _retry_on_permission(operation, *, error_key: str = "", **fmt_args) -> bool:

Callers 1

Calls 4

okMethod · 0.80
infoMethod · 0.80
warnMethod · 0.80
tFunction · 0.70

Tested by

no test coverage detected