fixed github formatting errors

This commit is contained in:
hippocritical 2023-03-05 16:19:26 +01:00
parent d92971cca1
commit d0d6f53dec
2 changed files with 6 additions and 7 deletions

View File

@ -1,6 +1,6 @@
import logging import logging
import os
import time import time
from pathlib import Path
from typing import Any, Dict from typing import Any, Dict
from freqtrade.configuration import setup_utils_configuration from freqtrade.configuration import setup_utils_configuration
@ -45,11 +45,11 @@ def start_strategy_update(args: Dict[str, Any]) -> None:
def start_conversion(strategy_obj, config): def start_conversion(strategy_obj, config):
# try: # try:
print(f"Conversion of {os.path.basename(strategy_obj['location'])} started.") print(f"Conversion of {Path(strategy_obj['location']).name} started.")
instance_strategy_updater = StrategyUpdater() instance_strategy_updater = StrategyUpdater()
start = time.perf_counter() start = time.perf_counter()
instance_strategy_updater.start(config, strategy_obj) instance_strategy_updater.start(config, strategy_obj)
elapsed = time.perf_counter() - start elapsed = time.perf_counter() - start
print(f"Conversion of {os.path.basename(strategy_obj['location'])} took {elapsed:.1f} seconds.") print(f"Conversion of {Path(strategy_obj['location']).name} took {elapsed:.1f} seconds.")
# except: # except:
# pass # pass

View File

@ -1,4 +1,3 @@
import os
import shutil import shutil
from pathlib import Path from pathlib import Path
@ -55,10 +54,10 @@ class StrategyUpdater:
target_file = Path.joinpath(strategies_backup_folder, strategy_obj['location_rel']) target_file = Path.joinpath(strategies_backup_folder, strategy_obj['location_rel'])
# read the file # read the file
with open(source_file, 'r') as f: with Path(source_file).open('r') as f:
old_code = f.read() old_code = f.read()
if not strategies_backup_folder.is_dir(): if not strategies_backup_folder.is_dir():
os.makedirs(strategies_backup_folder) Path(strategies_backup_folder).mkdir(parents=True, exist_ok=True)
# backup original # backup original
# => currently no date after the filename, # => currently no date after the filename,
@ -69,7 +68,7 @@ class StrategyUpdater:
# update the code # update the code
new_code = self.update_code(old_code) new_code = self.update_code(old_code)
# write the modified code to the destination folder # write the modified code to the destination folder
with open(source_file, 'w') as f: with Path(source_file).open('w') as f:
f.write(new_code) f.write(new_code)
# define the function to update the code # define the function to update the code