Browse Source

whitespace, minor cleanups

The MMGen Project 1 month ago
parent
commit
e1e1f07995
3 changed files with 8 additions and 6 deletions
  1. 2 2
      mmgen/base_obj.py
  2. 5 3
      mmgen/cfg.py
  3. 1 1
      mmgen/opts.py

+ 2 - 2
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):
 	"""

+ 5 - 3
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

+ 1 - 1
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
 """
 	}
 }