MCPcopy
hub / github.com/PDFMathTranslate/PDFMathTranslate / _save_config

Method _save_config

pdf2zh/config.py:54–60  ·  view source on GitHub ↗

保存配置到 config.json

(self)

Source from the content-addressed store, hash-verified

52 self._config_data = json.load(f)
53
54 def _save_config(self):
55 """保存配置到 config.json"""
56 with self._lock: # 加锁确保线程安全
57 # 移除循环引用并写入
58 cleaned_data = self._remove_circular_references(self._config_data)
59 with self._config_path.open("w", encoding="utf-8") as f:
60 json.dump(cleaned_data, f, indent=4, ensure_ascii=False)
61
62 def _remove_circular_references(self, obj, seen=None):
63 """递归移除循环引用"""

Callers 7

_ensure_config_existsMethod · 0.95
getMethod · 0.80
setMethod · 0.80
deleteMethod · 0.80
clearMethod · 0.80

Calls 1

Tested by

no test coverage detected