MCPcopy
hub / github.com/PDFMathTranslate/PDFMathTranslate / get_instance

Method get_instance

pdf2zh/config.py:13–20  ·  view source on GitHub ↗

获取单例实例

(cls)

Source from the content-addressed store, hash-verified

11
12 @classmethod
13 def get_instance(cls):
14 """获取单例实例"""
15 # 先判断是否存在实例,如果不存在再加锁进行初始化
16 if cls._instance is None:
17 with cls._lock:
18 if cls._instance is None:
19 cls._instance = cls()
20 return cls._instance
21
22 def __init__(self):
23 # 防止重复初始化

Callers 9

getMethod · 0.80
setMethod · 0.80
deleteMethod · 0.80
clearMethod · 0.80
allMethod · 0.80
removeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected