Browse Source

whitespace, minor fixes

The MMGen Project 1 week ago
parent
commit
fd65ae6660

+ 1 - 1
mmgen/help/xmrwallet.py

@@ -49,7 +49,7 @@ transfer  - transfer specified XMR amount from specified wallet:account to
             specified address
 sweep     - sweep funds in specified wallet:account to new address in same
             account, or new or specified account in another wallet
-sweep_all - same as above, but sweep balances of all addresses in the account
+sweep-all - same as above, but sweep balances of all addresses in the account
 relay     - relay a transaction from a transaction file created using ‘sweep’
             or ‘transfer’ with the --no-relay option
 submit    - submit an autosigned transaction to a wallet and the network

+ 2 - 2
mmgen/main_xmrwallet.py

@@ -111,9 +111,9 @@ cfg = Config(opts_data=opts_data, init_opts={'coin':'xmr'})
 cmd_args = cfg._args
 
 if cmd_args and cfg.autosign and (
-		cmd_args[0] in (
+		cmd_args[0].replace('-', '_') in (
 			xmrwallet.kafile_arg_ops
-			+ ('export-outputs', 'export-outputs-sign', 'import-key-images', 'txview', 'txlist')
+			+ ('export_outputs', 'export_outputs_sign', 'import_key_images', 'txview', 'txlist')
 		)
 		or len(cmd_args) == 1 and cmd_args[0] in ('submit', 'resubmit', 'abort')
 	):

+ 2 - 4
mmgen/tw/view.py

@@ -474,8 +474,7 @@ class TwView(MMGenObject, metaclass=AsyncInit):
 				tuple(gen_hdr(spc='' if line_processing == 'print' else ' ')),
 				tuple(
 					get_body(getattr(self, dt.fmt_method)) if data else
-					[(nocolor, yellow)[color](self.nodata_msg.ljust(self.term_width))])
-			)
+					[(nocolor, yellow)[color](self.nodata_msg.ljust(self.term_width))]))
 
 		if not gv.stdout.isatty():
 			line_processing = 'print'
@@ -536,8 +535,7 @@ class TwView(MMGenObject, metaclass=AsyncInit):
 			'\n'.join(display_hdr) + '\n'
 			+ dt.item_separator.join(display_body[top:bot])
 			+ fill
-			+ footer
-		)
+			+ footer)
 
 	async def view_filter_and_sort(self):
 

+ 3 - 4
mmgen/xmrwallet/ops/txview.py

@@ -53,8 +53,7 @@ class OpTxview(OpBase):
 			(self.hdr if len(files) > 1 else '')
 			+ self.col_hdr
 			+ '\n'.join(getattr(tx, self.view_method)(addr_w=addr_w) for tx in txs)
-			+ self.footer
-		)
+			+ self.footer)
 
 class OpTxlist(OpTxview):
 	view_method = 'get_info_oneline'
@@ -89,6 +88,6 @@ class OpTxlist(OpTxview):
 			from ...term import get_terminal_size
 			cols = self.cfg.columns or get_terminal_size().width
 			if cols < self.fixed_cols_w + self.min_addr_w:
-				die(1, f'A terminal at least {self.fixed_cols_w + self.min_addr_w} columns wide is required '
-						'to display this output (or use --columns or --pager)')
+				die(1, f'A terminal at least {self.fixed_cols_w + self.min_addr_w} columns wide is'
+						' required to display this output (or use --columns or --pager)')
 		await super().main(cols=cols)

+ 21 - 21
mmgen/xmrwallet/ops/wallet.py

@@ -32,8 +32,7 @@ class OpWallet(OpBase):
 		'no_start_wallet_daemon',
 		'no_stop_wallet_daemon',
 		'autosign',
-		'watch_only',
-	)
+		'watch_only')
 	wallet_offline = False
 	wallet_exists = True
 	start_daemon = True
@@ -70,8 +69,7 @@ class OpWallet(OpBase):
 			test_suite  = self.cfg.test_suite,
 			monerod_addr = self.cfg.daemon or None,
 			trust_monerod = self.trust_monerod,
-			test_monerod = not self.wallet_offline,
-		)
+			test_monerod = not self.wallet_offline)
 
 		if self.wallet_offline:
 			self.wd.usr_daemon_args = ['--offline']
@@ -79,8 +77,7 @@ class OpWallet(OpBase):
 		self.c = MoneroWalletRPCClient(
 			cfg             = self.cfg,
 			daemon          = self.wd,
-			test_connection = False,
-		)
+			test_connection = False)
 
 		if self.cfg.offline:
 			from ...wallet import Wallet
@@ -100,11 +97,14 @@ class OpWallet(OpBase):
 			self.mount_removable_device()
 			# with watch_only, make a second attempt to open the file as KeyAddrList:
 			for first_try in (True, False):
+				addr_list = ViewKeyAddrList if (self.cfg.watch_only and first_try) else KeyAddrList
 				try:
-					self.kal = (ViewKeyAddrList if (self.cfg.watch_only and first_try) else KeyAddrList)(
+					self.kal = addr_list(
 						cfg    = cfg,
 						proto  = self.proto,
-						infile = str(self.autosign_viewkey_addr_file) if self.cfg.autosign else self.uargs.infile,
+						infile =
+							str(self.autosign_viewkey_addr_file) if self.cfg.autosign else
+							self.uargs.infile,
 						key_address_validity_check = True,
 						skip_chksum_msg = True)
 					break
@@ -134,7 +134,9 @@ class OpWallet(OpBase):
 
 	def get_coin_daemon_rpc(self):
 
-		host, port = self.cfg.daemon.split(':') if self.cfg.daemon else ('localhost', self.wd.monerod_port)
+		host, port = (
+			self.cfg.daemon.split(':') if self.cfg.daemon else
+			('localhost', self.wd.monerod_port))
 
 		from ...daemon import CoinDaemon
 		return MoneroRPCClient(
@@ -154,10 +156,9 @@ class OpWallet(OpBase):
 			die(2,
 				'{a} viewkey-address files found in autosign mountpoint directory ‘{b}’!\n'.format(
 					a = 'Multiple' if flist else 'No',
-					b = self.asi.xmr_dir
-				)
-				+ 'Have you run ‘mmgen-autosign setup’ on your offline machine with the --xmrwallets option?'
-			)
+					b = self.asi.xmr_dir)
+				+ 'Have you run ‘mmgen-autosign setup’ on your offline machine'
+				' with the --xmrwallets option?')
 		else:
 			return flist[0]
 
@@ -166,7 +167,9 @@ class OpWallet(OpBase):
 			idxs = AddrIdxList(fmt_str=self.uargs.wallets)
 			self.addr_data = [d for d in self.kal.data if d.idx in idxs]
 			if len(self.addr_data) != len(idxs):
-				die(1, f'List {self.uargs.wallets!r} contains addresses not present in supplied key-address file')
+				die(1,
+					f'List {self.uargs.wallets!r} contains addresses not present'
+					' in supplied key-address file')
 		else:
 			self.addr_data = self.kal.data
 
@@ -179,7 +182,7 @@ class OpWallet(OpBase):
 			try:
 				await self.c.stop_daemon()
 			except KeyboardInterrupt:
-				ymsg('\nForce killing wallet daemon')
+				ymsg('\nForce-killing wallet daemon')
 				self.c.daemon.force_kill = True
 				self.c.daemon.stop()
 
@@ -192,8 +195,7 @@ class OpWallet(OpBase):
 				a = self.kal.al_id.sid,
 				b = data.idx,
 				c = 'WatchOnly' if watch_only else '',
-				d = f'.{self.cfg.network}' if self.cfg.network != 'mainnet' else '')
-		)
+				d = f'.{self.cfg.network}' if self.cfg.network != 'mainnet' else ''))
 
 	@property
 	def add_wallet_desc(self):
@@ -212,8 +214,7 @@ class OpWallet(OpBase):
 				a = self.stem.capitalize(),
 				b = n + 1,
 				c = len(self.addr_data),
-				d = fn.name,
-			))
+				d = fn.name))
 			processed += await self.process_wallet(d, fn, last=n==len(self.addr_data)-1)
 		gmsg(f'\n{processed} wallet{suf(processed)} {self.stem}ed\n')
 		return processed
@@ -223,5 +224,4 @@ class OpWallet(OpBase):
 			a = self.action.capitalize(),
 			b = self.add_wallet_desc,
 			c = wallet_idx,
-			d = fn.name
-		))
+			d = fn.name))

+ 3 - 3
test/cmdtest_d/xmr_autosign.py

@@ -50,15 +50,15 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded):
 
 	cmd_group = (
 		('daemon_version',           'checking daemon version'),
-		('gen_kafile_miner',         'generating key-address file for Miner'),
-		('create_wallet_miner',      'creating Monero wallet for Miner'),
-		('mine_initial_coins',       'mining initial coins'),
 		('create_tmp_wallets',       'creating temporary online wallets for Alice'),
 		('new_account_alice',        'adding an account to Alice’s tmp wallet'),
 		('new_address_alice',        'adding an address to Alice’s tmp wallet'),
 		('new_address_alice_label',  'adding an address to Alice’s tmp wallet (with label)'),
 		('dump_tmp_wallets',         'dumping Alice’s tmp wallets'),
 		('delete_tmp_wallets',       'deleting Alice’s tmp wallets'),
+		('gen_kafile_miner',         'generating key-address file for Miner'),
+		('create_wallet_miner',      'creating Monero wallet for Miner'),
+		('mine_initial_coins',       'mining initial coins'),
 		('autosign_setup',           'autosign setup with Alice’s seed'),
 		('autosign_xmr_setup',       'autosign setup (creation of Monero signing wallets)'),
 		('create_watchonly_wallets', 'creating watch-only wallets from Alice’s wallet dumps'),