From f5863a1c6fd3d8b29cde23561fb8b4dbfc86bf3d Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 15 Aug 2020 08:15:18 +0200 Subject: [PATCH] Fix mypy errors --- freqtrade/loggers.py | 16 ++++++++-------- freqtrade/rpc/rpc.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/freqtrade/loggers.py b/freqtrade/loggers.py index 6e66abeeb..263f97ce1 100644 --- a/freqtrade/loggers.py +++ b/freqtrade/loggers.py @@ -82,18 +82,18 @@ def setup_logging(config: Dict[str, Any]) -> None: except ImportError: raise OperationalException("You need the systemd python package be installed in " "order to use logging to journald.") - handler = JournaldLogHandler() + handler_jd = JournaldLogHandler() # No datetime field for logging into journald, to allow syslog # to perform reduction of repeating messages if this is set in the # syslog config. The messages should be equal for this. - handler.setFormatter(Formatter('%(name)s - %(levelname)s - %(message)s')) - logging.root.addHandler(handler) + handler_jd.setFormatter(Formatter('%(name)s - %(levelname)s - %(message)s')) + logging.root.addHandler(handler_jd) else: - handler = RotatingFileHandler(logfile, - maxBytes=1024 * 1024 * 10, # 10Mb - backupCount=10) - handler.setFormatter(Formatter(LOGFORMAT)) - logging.root.addHandler(handler) + handler_rf = RotatingFileHandler(logfile, + maxBytes=1024 * 1024 * 10, # 10Mb + backupCount=10) + handler_rf.setFormatter(Formatter(LOGFORMAT)) + logging.root.addHandler(handler_rf) logging.root.setLevel(logging.INFO if verbosity < 1 else logging.DEBUG) _set_loggers(verbosity, config.get('api_server', {}).get('verbosity', 'info')) diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index dd35b9613..37538499d 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -633,7 +633,7 @@ class RPC: } return res - def _rpc_get_logs(self, limit: Optional[int]) -> Dict[str, List]: + def _rpc_get_logs(self, limit: Optional[int]) -> Dict[str, Any]: """Returns the last X logs""" if limit: buffer = bufferHandler.buffer[-limit:] @@ -644,7 +644,7 @@ class RPC: return {'log_count': len(records), 'logs': records} - def _rpc_get_logs_as_string(self, limit: Optional[int]) -> Dict[str, List]: + def _rpc_get_logs_as_string(self, limit: Optional[int]) -> List[str]: """Returns the last X logs as formatted string (Using the default log format)""" if limit: buffer = bufferHandler.buffer[-limit:]