Simplify class setups without inheritance

This commit is contained in:
Matthias 2023-06-29 12:16:10 +00:00
parent b12dbd2bea
commit accc1b509b
10 changed files with 11 additions and 11 deletions

View File

@ -3,7 +3,7 @@ from typing import Callable
from cachetools import TTLCache, cached
class LoggingMixin():
class LoggingMixin:
"""
Logging Mixin
Shows similar messages only once every `refresh_period`.

View File

@ -35,7 +35,7 @@ def hyperopt_serializer(x):
return str(x)
class HyperoptStateContainer():
class HyperoptStateContainer:
""" Singleton class to track state of hyperopt"""
state: HyperoptState = HyperoptState.OPTIMIZE
@ -44,7 +44,7 @@ class HyperoptStateContainer():
cls.state = value
class HyperoptTools():
class HyperoptTools:
@staticmethod
def get_strategy_filename(config: Config, strategy_name: str) -> Optional[Path]:

View File

@ -42,7 +42,7 @@ class _KeyValueStoreModel(ModelBase):
int_value: Mapped[Optional[int]]
class KeyValueStore():
class KeyValueStore:
"""
Generic bot-wide, persistent key-value store
Can be used to store generic values, e.g. very first bot startup time.

View File

@ -11,7 +11,7 @@ from freqtrade.persistence.models import PairLock
logger = logging.getLogger(__name__)
class PairLocks():
class PairLocks:
"""
Pairlocks middleware class
Abstracts the database layer away so it becomes optional - which will be necessary to support

View File

@ -283,7 +283,7 @@ class Order(ModelBase):
return Order.session.scalars(select(Order).filter(Order.order_id == order_id)).first()
class LocalTrade():
class LocalTrade:
"""
Trade database model.
Used in backtesting - must be aligned to Trade model!

View File

@ -15,7 +15,7 @@ from freqtrade.resolvers import ProtectionResolver
logger = logging.getLogger(__name__)
class ProtectionManager():
class ProtectionManager:
def __init__(self, config: Config, protections: List) -> None:
self._config = config

View File

@ -14,7 +14,7 @@ class JobsContainer(TypedDict):
error: Optional[str]
class ApiBG():
class ApiBG:
# Backtesting type: Backtesting
bt: Dict[str, Any] = {
'bt': None,

View File

@ -168,7 +168,7 @@ class IStrategy(ABC, HyperStrategyMixin):
download_all_data_for_training(self.dp, self.config)
else:
# Gracious failures if freqAI is disabled but "start" is called.
class DummyClass():
class DummyClass:
def start(self, *args, **kwargs):
raise OperationalException(
'freqAI is not enabled. '

View File

@ -29,7 +29,7 @@ logging.basicConfig(
logger = logging.getLogger("ft_rest_client")
class FtRestClient():
class FtRestClient:
def __init__(self, serverurl, username=None, password=None):

View File

@ -342,7 +342,7 @@ def exchange_futures(request, exchange_conf, class_mocker):
@pytest.mark.longrun
class TestCCXTExchange():
class TestCCXTExchange:
def test_load_markets(self, exchange: EXCHANGE_FIXTURE_TYPE):
exch, exchangename = exchange