Improve code quality

This commit is contained in:
Matthias
2023-03-19 17:50:08 +01:00
parent 236499a195
commit 222ecdecd2
9 changed files with 15 additions and 16 deletions

View File

@@ -40,8 +40,8 @@ def setup_analyze_configuration(args: Dict[str, Any], method: RunMode) -> Dict[s
if (not Path(signals_file).exists()):
raise OperationalException(
(f"Cannot find latest backtest signals file: {signals_file}."
"Run backtesting with `--export signals`.")
f"Cannot find latest backtest signals file: {signals_file}."
"Run backtesting with `--export signals`."
)
return config

View File

@@ -1,4 +1,3 @@
import io
import logging
from copy import deepcopy
from datetime import datetime, timezone
@@ -464,7 +463,7 @@ class HyperoptTools():
return
try:
io.open(csv_file, 'w+').close()
Path(csv_file).open('w+').close()
except IOError:
logger.error(f"Failed to create CSV file: {csv_file}")
return

View File

@@ -1340,7 +1340,7 @@ class Telegram(RPCHandler):
message = tabulate({k: [v] for k, v in counts.items()},
headers=['current', 'max', 'total stake'],
tablefmt='simple')
message = "<pre>{}</pre>".format(message)
message = f"<pre>{message}</pre>"
logger.debug(message)
self._send_msg(message, parse_mode=ParseMode.HTML,
reload_able=True, callback_path="update_count",
@@ -1642,7 +1642,7 @@ class Telegram(RPCHandler):
])
else:
reply_markup = InlineKeyboardMarkup([[]])
msg += "\nUpdated: {}".format(datetime.now().ctime())
msg += f"\nUpdated: {datetime.now().ctime()}"
if not query.message:
return
chat_id = query.message.chat_id

View File

@@ -113,7 +113,7 @@ class Webhook(RPCHandler):
response = post(self._url, data=payload['data'],
headers={'Content-Type': 'text/plain'})
else:
raise NotImplementedError('Unknown format: {}'.format(self._format))
raise NotImplementedError(f'Unknown format: {self._format}')
# Throw a RequestException if the post was not successful
response.raise_for_status()