Move settings processing out of class scope

This commit is contained in:
lash 2022-05-12 13:49:23 +00:00
parent bfed5843b4
commit f5ab76e81a
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -9,12 +9,8 @@ class ChainSettings:
self.get = self.o.get self.get = self.o.get
def process_common(self, config): def set(self, k, v):
self.o['CHAIN_SPEC'] = ChainSpec.from_chain_str(config.get('CHAIN_SPEC')) self.o[k] = v
def process(self, config):
self.process_common(config)
def __str__(self): def __str__(self):
@ -24,3 +20,14 @@ class ChainSettings:
for k in ks: for k in ks:
s += '{}: {}\n'.format(k, self.o.get(k)) s += '{}: {}\n'.format(k, self.o.get(k))
return s 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