mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-03 09:22:30 +08:00
12 lines
251 B
Python
12 lines
251 B
Python
from functools import wraps
|
|
|
|
|
|
def singleton(cls):
|
|
instances = {}
|
|
@wraps(cls)
|
|
def getinstance(*args, **kw):
|
|
if cls not in instances:
|
|
instances[cls] = cls(*args, **kw)
|
|
return instances[cls]
|
|
return getinstance
|