chainlib

Generic blockchain access library and tooling
Log | Files | Refs | README | LICENSE

commit f5ab76e81ab95fd80e04b1a278b127f1cc791b5e
parent bfed5843b4573eace1fb8213d0f0c460e10f27f1
Author: lash <dev@holbrook.no>
Date:   Thu, 12 May 2022 13:49:23 +0000

Move settings processing out of class scope

Diffstat:
Mchainlib/settings.py | 19+++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

diff --git 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