Improve some typing

This commit is contained in:
Matthias
2022-05-25 20:43:43 +02:00
parent 3e66275c98
commit 537d10c627
5 changed files with 11 additions and 5 deletions

View File

@@ -490,7 +490,8 @@ class Configuration:
if not pairs_file.exists():
raise OperationalException(f'No pairs file found with path "{pairs_file}".')
config['pairs'] = load_file(pairs_file)
config['pairs'].sort()
if isinstance(config['pairs'], list):
config['pairs'].sort()
return
if 'config' in self.args and self.args['config']:
@@ -501,5 +502,5 @@ class Configuration:
pairs_file = config['datadir'] / 'pairs.json'
if pairs_file.exists():
config['pairs'] = load_file(pairs_file)
if 'pairs' in config:
if 'pairs' in config and isinstance(config['pairs'], list):
config['pairs'].sort()

View File

@@ -15,7 +15,7 @@ def create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> Pat
folder = Path(datadir) if datadir else Path(f"{config['user_data_dir']}/data")
if not datadir:
# set datadir
exchange_name = config.get('exchange', {}).get('name').lower()
exchange_name = config.get('exchange', {}).get('name', '').lower()
folder = folder.joinpath(exchange_name)
if not folder.is_dir():