config, optimize: fstrings in use

This commit is contained in:
Samuel Husso 2018-06-14 08:31:29 +03:00
parent d8d0579c5a
commit 03c112a601
2 changed files with 5 additions and 8 deletions

View File

@ -62,8 +62,8 @@ class Configuration(object):
conf = json.load(file) conf = json.load(file)
except FileNotFoundError: except FileNotFoundError:
raise OperationalException( raise OperationalException(
'Config file "{}" not found!' f'Config file "{path}" not found!'
' Please create a config file or check whether it exists.'.format(path)) ' Please create a config file or check whether it exists.')
if 'internals' not in conf: if 'internals' not in conf:
conf['internals'] = {} conf['internals'] = {}
@ -109,7 +109,7 @@ class Configuration(object):
config['db_url'] = constants.DEFAULT_DB_PROD_URL config['db_url'] = constants.DEFAULT_DB_PROD_URL
logger.info('Dry run is disabled') logger.info('Dry run is disabled')
logger.info('Using DB: "{}"'.format(config['db_url'])) logger.info(f'Using DB: "{config["db_url"]}"')
# Check if the exchange set by the user is supported # Check if the exchange set by the user is supported
self.check_exchange(config) self.check_exchange(config)

View File

@ -54,11 +54,8 @@ def load_tickerdata_file(
:return dict OR empty if unsuccesful :return dict OR empty if unsuccesful
""" """
path = make_testdata_path(datadir) path = make_testdata_path(datadir)
pair_file_string = pair.replace('/', '_') pair_s = pair.replace('/', '_')
file = os.path.join(path, '{pair}-{ticker_interval}.json'.format( file = os.path.join(path, f'{pair_s}-{ticker_interval}.json')
pair=pair_file_string,
ticker_interval=ticker_interval,
))
gzipfile = file + '.gz' gzipfile = file + '.gz'
# If the file does not exist we download it when None is returned. # If the file does not exist we download it when None is returned.