From f16324071054f35f3e04543810558699e13eba2a Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 13 Sep 2019 07:02:36 +0200 Subject: [PATCH] Simplify configuration init where possible --- freqtrade/configuration/configuration.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/freqtrade/configuration/configuration.py b/freqtrade/configuration/configuration.py index 1811cc6ed..547bfc135 100644 --- a/freqtrade/configuration/configuration.py +++ b/freqtrade/configuration/configuration.py @@ -106,10 +106,7 @@ class Configuration: the -v/--verbose, --logfile options """ # Log level - if 'verbosity' in self.args and self.args["verbosity"]: - config.update({'verbosity': self.args["verbosity"]}) - else: - config.update({'verbosity': 0}) + config.update({'verbosity': self.args.get("verbosity", 0)}) if 'logfile' in self.args and self.args["logfile"]: config.update({'logfile': self.args["logfile"]}) @@ -121,8 +118,8 @@ class Configuration: self._process_logging_options(config) # Set strategy if not specified in config and or if it's non default - if self.args["strategy"] != constants.DEFAULT_STRATEGY or not config.get('strategy'): - config.update({'strategy': self.args["strategy"]}) + if self.args.get("strategy") != constants.DEFAULT_STRATEGY or not config.get('strategy'): + config.update({'strategy': self.args.get("strategy")}) self._args_to_config(config, argname='strategy_path', logstring='Using additional Strategy lookup path: {}') @@ -175,10 +172,7 @@ class Configuration: config['user_data_dir'] = create_userdata_dir(config['user_data_dir'], create_dir=False) logger.info('Using user-data directory: %s ...', config['user_data_dir']) - if 'datadir' in self.args and self.args["datadir"]: - config.update({'datadir': create_datadir(config, self.args["datadir"])}) - else: - config.update({'datadir': create_datadir(config, None)}) + config.update({'datadir': create_datadir(config, self.args.get("datadir", None))}) logger.info('Using data directory: %s ...', config.get('datadir')) def _process_optimize_options(self, config: Dict[str, Any]) -> None: