feat:初版

This commit is contained in:
2025-12-03 15:48:44 +08:00
commit b4df26f61d
199 changed files with 23434 additions and 0 deletions

18
utils/singleton.py Normal file
View File

@@ -0,0 +1,18 @@
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super().__call__(*args, **kwargs)
return cls._instances[cls]
@classmethod
def reset_instance(mcs, cls):
"""重置指定类的单例实例"""
if cls in mcs._instances:
del mcs._instances[cls]
@classmethod
def reset_all(mcs):
"""重置所有单例实例"""
mcs._instances.clear()