From e1e1f079950a0a1e3072cb31614c87651bd8f915 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 8 Oct 2024 12:56:01 +0000 Subject: [PATCH] whitespace, minor cleanups --- mmgen/base_obj.py | 4 ++-- mmgen/cfg.py | 8 +++++--- mmgen/opts.py | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mmgen/base_obj.py b/mmgen/base_obj.py index 09eaa31e..65abae00 100755 --- a/mmgen/base_obj.py +++ b/mmgen/base_obj.py @@ -88,10 +88,10 @@ class AttrCtrl(metaclass=AttrCtrlMeta): return object.__setattr__(self,name,value) - def __delattr__(self,name): + def __delattr__(self, name): if self._locked and not name in self._delete_ok: raise AttributeError('attribute cannot be deleted') - return object.__delattr__(self,name) + return object.__delattr__(self, name) class Lockable(AttrCtrl): """ diff --git a/mmgen/cfg.py b/mmgen/cfg.py index c6234d3f..64eac0ae 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -34,7 +34,7 @@ def die2(exit_val,s): class GlobalConstants(Lockable): """ - These values are non-configurable. They’re constant for a given machine, + These values are non-runtime-configurable. They’re constant for a given machine, user, executable and MMGen release. """ _autolock = True @@ -527,7 +527,7 @@ class Config(Lockable): # Step 6: set auto typeset opts from user-supplied data or cfgfile data, in that order: self._set_auto_typeset_opts( self._cfgfile_opts.auto_typeset ) - if self.regtest or self.bob or self.alice or self.carol or gc.prog_name == 'mmgen-regtest': + if self.regtest or self.bob or self.alice or self.carol or gc.prog_name == f'{gc.proj_id}-regtest': self.network = 'regtest' self.regtest_user = 'bob' if self.bob else 'alice' if self.alice else 'carol' if self.carol else None else: @@ -563,7 +563,6 @@ class Config(Lockable): from .protocol import init_proto_from_cfg, warn_trustlevel # requires the default-to-none behavior, so do after the lock: self._proto = init_proto_from_cfg(self,need_amt=need_amt) - warn_trustlevel(self) # do this after initializing proto if self._opts and not caller_post_init: self._post_init() @@ -571,6 +570,9 @@ class Config(Lockable): # Check user-set opts without modifying them check_opts(self) + if need_proto: + warn_trustlevel(self) # do this only after proto is initialized + def _post_init(self): if self.help or self.longhelp: self._opts.init_bottom(self) # exits diff --git a/mmgen/opts.py b/mmgen/opts.py index c0fb8f51..92a9c224 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -85,7 +85,7 @@ opts_data_dfl = { 'usage':'[options]', 'options': """ -h, --help Print this help message ---, --longhelp Print help message for long (common) options +--, --longhelp Print help message for long (global) options """ } }