mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-03 10:40:02 +08:00
添加单例注解
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class Singleton:
|
||||
|
||||
"""
|
||||
单例注解
|
||||
"""
|
||||
|
||||
def __init__(self, cls):
|
||||
self._cls = cls
|
||||
|
||||
def __call__(self, *args, **kw):
|
||||
if not hasattr(self, "_instance"):
|
||||
self._instance = self._cls(*args, **kw)
|
||||
return self._instance
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user