interface with interlm

这个提交包含在:
binary-husky
2023-07-18 16:33:34 +08:00
父节点 eef9e470c9
当前提交 babb775cfb
共有 3 个文件被更改,包括 310 次插入2 次删除

查看文件

@@ -883,4 +883,16 @@ def objload(file='objdump.tmp'):
return
with open(file, 'rb') as f:
return pickle.load(f)
def Singleton(cls):
"""
一个单实例装饰器
"""
_instance = {}
def _singleton(*args, **kargs):
if cls not in _instance:
_instance[cls] = cls(*args, **kargs)
return _instance[cls]
return _singleton