MCPcopy Index your code
hub / github.com/PDFMathTranslate/PDFMathTranslate / custome_config

Method custome_config

pdf2zh/config.py:80–91  ·  view source on GitHub ↗

使用自定义路径加载配置文件

(cls, file_path)

Source from the content-addressed store, hash-verified

78
79 @classmethod
80 def custome_config(cls, file_path):
81 """使用自定义路径加载配置文件"""
82 custom_path = Path(file_path)
83 if not custom_path.exists():
84 raise ValueError(f"Config file {custom_path} not found!")
85 # 加锁
86 with cls._lock:
87 instance = cls()
88 instance._config_path = custom_path
89 # 此处传 isInit=False,若不存在则报错;若存在则正常 _load_config()
90 instance._ensure_config_exists(isInit=False)
91 cls._instance = instance
92
93 @classmethod
94 def get(cls, key, default=None):

Callers 1

mainFunction · 0.80

Calls 1

_ensure_config_existsMethod · 0.80

Tested by

no test coverage detected