[Del]remove Singleton

This commit is contained in:
vn.py 2019-04-11 16:54:43 +08:00
parent 6c15a50599
commit 1d6506c5f3
2 changed files with 2 additions and 21 deletions

View File

@ -24,7 +24,7 @@ from .event import (
from .gateway import BaseGateway
from .object import CancelRequest, LogData, OrderRequest, SubscribeRequest
from .setting import SETTINGS
from .utility import Singleton, get_folder_path
from .utility import get_folder_path
class MainEngine:
@ -197,7 +197,7 @@ class BaseEngine(ABC):
pass
class LogEngine(BaseEngine, metaclass=Singleton):
class LogEngine(BaseEngine):
"""
Processes log event and output with logging module.
"""

View File

@ -12,25 +12,6 @@ import talib
from .object import BarData, TickData
class Singleton(type):
"""
Singleton metaclass,
usage:
class A(metaclass=Singleton):
...
"""
_instances = {}
def __call__(cls, *args, **kwargs):
""""""
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(
*args, **kwargs
)
return cls._instances[cls]
def _get_trader_dir(temp_name: str):
"""
Get path where trader is running in.