use Config typing in more places

This commit is contained in:
Matthias
2022-09-18 13:31:52 +02:00
parent 667853c504
commit 994c1c5ea0
32 changed files with 79 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
import logging
from typing import Any, Dict
from freqtrade.constants import Config
from freqtrade.enums import RPCMessageType
from freqtrade.rpc import RPC
from freqtrade.rpc.webhook import Webhook
@@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
class Discord(Webhook):
def __init__(self, rpc: 'RPC', config: Dict[str, Any]):
def __init__(self, rpc: 'RPC', config: Config):
# super().__init__(rpc, config)
self.rpc = rpc
self.config = config

View File

@@ -5,6 +5,7 @@ import logging
from collections import deque
from typing import Any, Dict, List
from freqtrade.constants import Config
from freqtrade.enums import RPCMessageType
from freqtrade.rpc import RPC, RPCHandler
@@ -89,7 +90,7 @@ class RPCManager:
'msg': msg,
})
def startup_messages(self, config: Dict[str, Any], pairlist, protections) -> None:
def startup_messages(self, config: Config, pairlist, protections) -> None:
if config['dry_run']:
self.send_msg({
'type': RPCMessageType.WARNING,

View File

@@ -24,7 +24,7 @@ from telegram.ext import CallbackContext, CallbackQueryHandler, CommandHandler,
from telegram.utils.helpers import escape_markdown
from freqtrade.__init__ import __version__
from freqtrade.constants import DUST_PER_COIN
from freqtrade.constants import DUST_PER_COIN, Config
from freqtrade.enums import RPCMessageType, SignalDirection, TradingMode
from freqtrade.exceptions import OperationalException
from freqtrade.misc import chunks, plural, round_coin_value
@@ -88,7 +88,7 @@ def authorized_only(command_handler: Callable[..., None]) -> Callable[..., Any]:
class Telegram(RPCHandler):
""" This class handles all telegram communication """
def __init__(self, rpc: RPC, config: Dict[str, Any]) -> None:
def __init__(self, rpc: RPC, config: Config) -> None:
"""
Init the Telegram call, and init the super class RPCHandler
:param rpc: instance of RPC Helper class

View File

@@ -7,6 +7,7 @@ from typing import Any, Dict
from requests import RequestException, post
from freqtrade.constants import Config
from freqtrade.enums import RPCMessageType
from freqtrade.rpc import RPC, RPCHandler
@@ -19,7 +20,7 @@ logger.debug('Included module rpc.webhook ...')
class Webhook(RPCHandler):
""" This class handles all webhook communication """
def __init__(self, rpc: RPC, config: Dict[str, Any]) -> None:
def __init__(self, rpc: RPC, config: Config) -> None:
"""
Init the Webhook class, and init the super class RPCHandler
:param rpc: instance of RPC Helper class