From ce74892b9aff40bcd0267486ac737921d3c5cca8 Mon Sep 17 00:00:00 2001 From: liuly12 <59883247+liuly12@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:02:39 +0100 Subject: [PATCH] Use set rather than list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Diego Alonso Álvarez <6095790+dalonsoa@users.noreply.github.com> --- wsimod/nodes/storage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wsimod/nodes/storage.py b/wsimod/nodes/storage.py index 546201a..38fab45 100644 --- a/wsimod/nodes/storage.py +++ b/wsimod/nodes/storage.py @@ -612,7 +612,7 @@ def apply_overrides(self, overrides=Dict[str, Any]): overrides (Dict[str, Any]): Dict describing which parameters should be overridden (keys) and new values (values). Defaults to {}. """ - overwrite_params = [ + overwrite_params = set([ "length", "width", "velocity", @@ -631,10 +631,10 @@ def apply_overrides(self, overrides=Dict[str, Any]): "muptPpar", "max_temp_lag", "max_phosphorus_lag", - ] + ]) - for param in overwrite_params: - setattr(self, param, overrides.pop(param, getattr(self, param))) + for param in overwrite_params.intersection(overrides.keys()): + setattr(self, param, overrides.pop(param)) if "area" in overrides.keys(): print(