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
1 changed files with 13 additions and 6 deletions

View File

@ -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