Browse Source

minor cleanups, whitespace

The MMGen Project 2 months ago
parent
commit
941bbdc4b5
4 changed files with 11 additions and 8 deletions
  1. 1 1
      mmgen/base_obj.py
  2. 5 1
      mmgen/opts.py
  3. 3 5
      mmgen/proto/btc/rpc.py
  4. 2 1
      test/misc/cfg_main.py

+ 1 - 1
mmgen/base_obj.py

@@ -59,7 +59,7 @@ class AttrCtrl(metaclass=AttrCtrlMeta):
 		if self._locked and self._default_to_none:
 			return None
 		else:
-			raise AttributeError(f'{type(self).__name__} object has no attribute {name!r}')
+			raise AttributeError(f'{self} has no attribute {name!r}')
 
 	def __setattr__(self, name, value):
 

+ 5 - 1
mmgen/opts.py

@@ -213,7 +213,11 @@ class Opts:
 		self.global_opts_filter = self.get_global_opts_filter(need_proto)
 		self.opts_data = opts_data
 
-		po = parsed_opts or parse_opts(opts_data, opt_filter, self.global_opts_data, self.global_opts_filter)
+		po = parsed_opts or parse_opts(
+			opts_data,
+			opt_filter,
+			self.global_opts_data,
+			self.global_opts_filter)
 
 		cfg._args = po.cmd_args
 		cfg._uopts = uopts = po.user_opts

+ 3 - 5
mmgen/proto/btc/rpc.py

@@ -224,15 +224,13 @@ class BitcoinRPCClient(RPCClient, metaclass=AsyncInit):
 			return
 
 		if self.has_auth_cookie:
-			cookie = self.get_daemon_auth_cookie()
-			if cookie:
+			if cookie := self.get_daemon_auth_cookie():
 				self.auth = auth_data(*cookie.split(':'))
 				return
 
 		die(1, '\n\n' + fmt(no_credentials_errmsg, strip_char='\t', indent='  ').format(
-				proto_name = self.proto.name,
-				cf_name = (self.proto.is_fork_of or self.proto.name).lower(),
-			))
+			proto_name = self.proto.name,
+			cf_name = (self.proto.is_fork_of or self.proto.name).lower()))
 
 	def make_host_path(self, wallet):
 		return f'/wallet/{wallet}' if wallet else self.wallet_path

+ 2 - 1
test/misc/cfg_main.py

@@ -31,7 +31,8 @@ if op:
 		msg('usr cfg: {}'.format(' '.join(f'{i.name}={i.value}' for i in pu)))
 	elif op == 'coin_specific_vars':
 		for varname in args:
-			msg('{}.{}: {}'.format(
+			msg('{}.{}.{}: {}'.format(
+				cfg._proto.coin.lower(),
 				type(cfg._proto).__name__,
 				varname,
 				getattr(cfg._proto, varname)