From f5ab76e81ab95fd80e04b1a278b127f1cc791b5e Mon Sep 17 00:00:00 2001 From: lash Date: Thu, 12 May 2022 13:49:23 +0000 Subject: [PATCH] Move settings processing out of class scope --- chainlib/settings.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/chainlib/settings.py b/chainlib/settings.py index de4d448..45c5171 100644 --- a/chainlib/settings.py +++ b/chainlib/settings.py @@ -9,12 +9,8 @@ class ChainSettings: self.get = self.o.get - def process_common(self, config): - self.o['CHAIN_SPEC'] = ChainSpec.from_chain_str(config.get('CHAIN_SPEC')) - - - def process(self, config): - self.process_common(config) + def set(self, k, v): + self.o[k] = v def __str__(self): @@ -24,3 +20,14 @@ class ChainSettings: for k in ks: s += '{}: {}\n'.format(k, self.o.get(k)) return s + + +def process_settings_common(settings, config): + chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC')) + settings.set('CHAIN_SPEC', chain_spec) + return settings + + +def process_settings(settings, config): + settings = process_settings_common(settings, config) + return settings