Browse Source

whitespace, minor fixes

The MMGen Project 1 day ago
parent
commit
e865170484
4 changed files with 12 additions and 19 deletions
  1. 3 3
      mmgen/autosign.py
  2. 5 11
      mmgen/cfg.py
  3. 3 5
      mmgen/proto/xmr/rpc.py
  4. 1 0
      mmgen/xmrwallet/__init__.py

+ 3 - 3
mmgen/autosign.py

@@ -19,7 +19,7 @@ from subprocess import run, PIPE, DEVNULL
 
 
 from .cfg import Config
 from .cfg import Config
 from .util import msg, msg_r, ymsg, rmsg, gmsg, bmsg, die, suf, fmt, fmt_list, is_int, have_sudo, capfirst
 from .util import msg, msg_r, ymsg, rmsg, gmsg, bmsg, die, suf, fmt, fmt_list, is_int, have_sudo, capfirst
-from .color import yellow, red, orange, brown, blue
+from .color import yellow, red, orange, brown, blue, gray
 from .wallet import Wallet, get_wallet_cls
 from .wallet import Wallet, get_wallet_cls
 from .addrlist import AddrIdxList
 from .addrlist import AddrIdxList
 from .filename import find_file_in_dir
 from .filename import find_file_in_dir
@@ -641,7 +641,7 @@ class Autosign:
 			redir = None if verbose else DEVNULL
 			redir = None if verbose else DEVNULL
 			if run(self.mount_cmd.split(), stderr=redir, stdout=redir).returncode == 0:
 			if run(self.mount_cmd.split(), stderr=redir, stdout=redir).returncode == 0:
 				if not silent:
 				if not silent:
-					msg(f'Mounting ‘{self.mountpoint}’')
+					msg(gray(f'Mounting ‘{self.mountpoint}’'))
 			else:
 			else:
 				die(1, f'Unable to mount device ‘{self.dev_label}’ at ‘{self.mountpoint}’')
 				die(1, f'Unable to mount device ‘{self.dev_label}’ at ‘{self.mountpoint}’')
 
 
@@ -652,7 +652,7 @@ class Autosign:
 		if self.mountpoint.is_mount():
 		if self.mountpoint.is_mount():
 			run(['sync'], check=True)
 			run(['sync'], check=True)
 			if not silent:
 			if not silent:
-				msg(f'Unmounting ‘{self.mountpoint}’')
+				msg(gray(f'Unmounting ‘{self.mountpoint}’'))
 			redir = None if verbose else DEVNULL
 			redir = None if verbose else DEVNULL
 			run(self.umount_cmd.split(), stdout=redir, check=True)
 			run(self.umount_cmd.split(), stdout=redir, check=True)
 		if not silent:
 		if not silent:

+ 5 - 11
mmgen/cfg.py

@@ -217,8 +217,7 @@ class Config(Lockable):
 	columns         = 0
 	columns         = 0
 	color = bool(
 	color = bool(
 		(sys.stdout.isatty() and not os.getenv('MMGEN_TEST_SUITE_PEXPECT')) or
 		(sys.stdout.isatty() and not os.getenv('MMGEN_TEST_SUITE_PEXPECT')) or
-		os.getenv('MMGEN_TEST_SUITE_ENABLE_COLOR')
-	)
+		os.getenv('MMGEN_TEST_SUITE_ENABLE_COLOR'))
 
 
 	# miscellaneous features:
 	# miscellaneous features:
 	use_internal_keccak_module     = False
 	use_internal_keccak_module     = False
@@ -280,9 +279,7 @@ class Config(Lockable):
 	_use_cfg_file           = False
 	_use_cfg_file           = False
 	_use_env                = False
 	_use_env                = False
 
 
-	_forbidden_opts = (
-		'data_dir_root',
-	)
+	_forbidden_opts = ('data_dir_root',)
 
 
 	_incompatible_opts = (
 	_incompatible_opts = (
 		('help', 'longhelp'),
 		('help', 'longhelp'),
@@ -290,8 +287,7 @@ class Config(Lockable):
 		('label', 'keep_label'),
 		('label', 'keep_label'),
 		('tx_id', 'info'),
 		('tx_id', 'info'),
 		('tx_id', 'terse_info'),
 		('tx_id', 'terse_info'),
-		('autosign', 'outdir'),
-	)
+		('autosign', 'outdir'))
 
 
 	# proto-specific only: eth_mainnet_chain_names eth_testnet_chain_names
 	# proto-specific only: eth_mainnet_chain_names eth_testnet_chain_names
 	# coin-specific only:  bch_cashaddr (alias of cashaddr)
 	# coin-specific only:  bch_cashaddr (alias of cashaddr)
@@ -376,8 +372,7 @@ class Config(Lockable):
 		'MMGEN_IGNORE_DAEMON_VERSION',
 		'MMGEN_IGNORE_DAEMON_VERSION',
 		'MMGEN_USE_STANDALONE_SCRYPT_MODULE',
 		'MMGEN_USE_STANDALONE_SCRYPT_MODULE',
 		'MMGEN_ENABLE_ERIGON',
 		'MMGEN_ENABLE_ERIGON',
-		'MMGEN_DISABLE_COLOR',
-	)
+		'MMGEN_DISABLE_COLOR')
 
 
 	_infile_opts = (
 	_infile_opts = (
 		'keys_from_file',
 		'keys_from_file',
@@ -385,8 +380,7 @@ class Config(Lockable):
 		'passwd_file',
 		'passwd_file',
 		'keysforaddrs',
 		'keysforaddrs',
 		'comment_file',
 		'comment_file',
-		'contract_data',
-	)
+		'contract_data')
 
 
 	# Auto-typechecked and auto-set opts - first value in list is the default
 	# Auto-typechecked and auto-set opts - first value in list is the default
 	_ov = namedtuple('autoset_opt_info', ['type', 'choices'])
 	_ov = namedtuple('autoset_opt_info', ['type', 'choices'])

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

@@ -67,8 +67,7 @@ class MoneroRPCClient(RPCClient):
 				self.daemon_version_str = ver_str
 				self.daemon_version_str = ver_str
 				self.daemon_version = sum(
 				self.daemon_version = sum(
 					int(m) * (1000 ** n) for n, m in
 					int(m) * (1000 ** n) for n, m in
-						enumerate(reversed(re.match(r'(\d+)\.(\d+)\.(\d+)\.(\d+)', ver_str).groups()))
-				)
+						enumerate(reversed(re.match(r'(\d+)\.(\d+)\.(\d+)\.(\d+)', ver_str).groups())))
 				if self.daemon and self.daemon_version > self.daemon.coind_version:
 				if self.daemon and self.daemon_version > self.daemon.coind_version:
 					self.handle_unsupported_daemon_version(
 					self.handle_unsupported_daemon_version(
 						proto.name,
 						proto.name,
@@ -82,8 +81,7 @@ class MoneroRPCClient(RPCClient):
 		return self.process_http_resp(self.backend.run_noasync(
 		return self.process_http_resp(self.backend.run_noasync(
 			payload = {'id': 0, 'jsonrpc': '2.0', 'method': method, 'params': kwargs},
 			payload = {'id': 0, 'jsonrpc': '2.0', 'method': method, 'params': kwargs},
 			timeout = 3600, # allow enough time to sync ≈1,000,000 blocks
 			timeout = 3600, # allow enough time to sync ≈1,000,000 blocks
-			host_path = '/json_rpc'
-		))
+			host_path = '/json_rpc'))
 
 
 	def call_raw(self, method, *params, **kwargs):
 	def call_raw(self, method, *params, **kwargs):
 		assert not params, f'{self.name}.call() accepts keyword arguments only'
 		assert not params, f'{self.name}.call() accepts keyword arguments only'
@@ -91,7 +89,7 @@ class MoneroRPCClient(RPCClient):
 			payload = kwargs,
 			payload = kwargs,
 			timeout = self.timeout,
 			timeout = self.timeout,
 			host_path = f'/{method}'
 			host_path = f'/{method}'
-		), json_rpc=False)
+		), json_rpc = False)
 
 
 	async def do_stop_daemon(self, *, silent=False):
 	async def do_stop_daemon(self, *, silent=False):
 		return self.call_raw('stop_daemon') # unreliable on macOS (daemon stops, but closes connection)
 		return self.call_raw('stop_daemon') # unreliable on macOS (daemon stops, but closes connection)

+ 1 - 0
mmgen/xmrwallet/__init__.py

@@ -124,6 +124,7 @@ def op(op, cfg, infile, wallets, *, spec=None, compat_call=False):
 		cfg = Config({
 		cfg = Config({
 			'_clone': cfg,
 			'_clone': cfg,
 			'compat': True,
 			'compat': True,
+			'full_address': cfg.full_address or compat_call,
 			'xmrwallet_compat': True} | ({} if cfg.offline else {
 			'xmrwallet_compat': True} | ({} if cfg.offline else {
 				'no_start_wallet_daemon': cfg.no_start_wallet_daemon or compat_call,
 				'no_start_wallet_daemon': cfg.no_start_wallet_daemon or compat_call,
 				'daemon': cfg.daemon or cfg.monero_daemon,
 				'daemon': cfg.daemon or cfg.monero_daemon,