[Mod] 改变Singleton的使用说明

This commit is contained in:
nanoric 2019-04-11 00:43:46 -04:00
parent 0e67e75d6c
commit 70adba7637
2 changed files with 5 additions and 6 deletions

View File

@ -197,13 +197,11 @@ class BaseEngine(ABC):
pass
class LogEngine(BaseEngine):
class LogEngine(BaseEngine, metaclass=Singleton):
"""
Processes log event and output with logging module.
"""
__metaclass__ = Singleton
def __init__(self, main_engine: MainEngine, event_engine: EventEngine):
""""""
super(LogEngine, self).__init__(main_engine, event_engine, "log")

View File

@ -16,8 +16,9 @@ class Singleton(type):
"""
Singleton metaclass,
class A:
__metaclass__ = Singleton
usage:
class A(metaclass=Singleton):
...
"""
_instances = {}