From 7746467ec8a665b4422cadf65e09ec0f54dae479 Mon Sep 17 00:00:00 2001 From: Philipp Weiler Date: Mon, 30 Aug 2021 10:48:53 +0200 Subject: [PATCH] Simplify updating `ot_configs` Instead of looping over the (potentially) new configurations, Python's `.update` function for dictionaries can be used directly. --- wot/ot/ot_model.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/wot/ot/ot_model.py b/wot/ot/ot_model.py index 43a5f30..f84e34e 100644 --- a/wot/ot/ot_model.py +++ b/wot/ot/ot_model.py @@ -94,13 +94,11 @@ def __init__(self, matrix, day_field='day', covariate_field='covariate', raise ValueError('Unknown solver') parameters_from_file = kwargs.pop('parameters', None) - for k in kwargs.keys(): - self.ot_config[k] = kwargs[k] + self.ot_config.update(kwargs) if parameters_from_file is not None: config_dict = wot.ot.parse_parameter_file(parameters_from_file) - for k in config_dict.keys(): - self.ot_config[k] = config_dict[k] + self.ot_config.update(config_dict) local_pca = self.ot_config['local_pca'] if local_pca > self.matrix.X.shape[1]: