Browse Source

xmrwallet: whitespace

The MMGen Project 6 days ago
parent
commit
36d82c5f91

+ 2 - 4
mmgen/xmrwallet/file/__init__.py

@@ -24,8 +24,7 @@ class MoneroMMGenFile:
 	def make_chksum(self, *, keys=None):
 		res = json.dumps(
 			dict((k, v) for k, v in self.data._asdict().items() if (not keys or k in keys)),
-			cls = json_encoder
-		)
+			cls = json_encoder)
 		return make_chksum_N(res, rounds=1, nchars=self.chksum_nchars, upper=False)
 
 	@property
@@ -54,8 +53,7 @@ class MoneroMMGenFile:
 		return json.dumps(
 			{self.data_label: out},
 			cls = json_encoder,
-			indent = 2,
-		)
+			indent = 2)
 
 	def extract_data_from_file(self, cfg, fn):
 		return json.loads(

+ 7 - 14
mmgen/xmrwallet/file/outputs.py

@@ -38,8 +38,7 @@ class MoneroWalletOutputsFile:
 			'outputs_data_hex',
 			'signed_key_images',
 			'sign',
-			'imported',
-		])
+			'imported'])
 
 		def __init__(self, cfg):
 			self.name = type(self).__name__
@@ -62,13 +61,11 @@ class MoneroWalletOutputsFile:
 				wallet_fn.parent) / self.fn_fs.format(
 					a = wallet_fn.name,
 					b = self.base_chksum,
-					c = self.ext,
-				)
+					c = self.ext)
 
 		def get_wallet_fn(self, fn):
 			assert fn.name.endswith(f'.{self.ext}'), (
-				f'{self.name}: filename does not end with {"."+self.ext!r}'
-			)
+				f'{self.name}: filename does not end with {"."+self.ext!r}')
 			return fn.parent / fn.name[:-(len(self.ext)+self.ext_offset+1)]
 
 		def get_info(self, *, indent=''):
@@ -109,8 +106,7 @@ class MoneroWalletOutputsFile:
 				parent     = parent,
 				wallet_fn  = wallet_fn,
 				data       = data,
-				wallet_idx = wallet_idx,
-			)
+				wallet_idx = wallet_idx)
 			self.check_checksums(d_wrap)
 
 		@classmethod
@@ -119,8 +115,7 @@ class MoneroWalletOutputsFile:
 			pat = cls.fn_fs.format(
 				a = wallet_fn.name,
 				b = f'[0-9a-f]{{{cls.chksum_nchars}}}\\',
-				c = cls.ext,
-			)
+				c = cls.ext)
 			matches = [f for f in path.iterdir() if re.match(pat, f.name)]
 			if not matches and ret_on_no_match:
 				return None
@@ -128,8 +123,7 @@ class MoneroWalletOutputsFile:
 				die(2, "{a} matching pattern {b!r} found in '{c}'!".format(
 					a = 'No files' if not matches else 'More than one file',
 					b = pat,
-					c = path
-				))
+					c = path))
 			return matches[0]
 
 	class Unsigned(Completed):
@@ -154,8 +148,7 @@ class MoneroWalletDumpFile:
 		data_tuple = namedtuple('wallet_dump_data', [
 			'seed_id',
 			'wallet_index',
-			'wallet_metadata',
-		])
+			'wallet_metadata'])
 		def get_outfile(self, cfg, wallet_fn):
 			return wallet_fn.parent / f'{wallet_fn.name}.{self.ext}'
 

+ 2 - 1
mmgen/xmrwallet/include.py

@@ -77,7 +77,8 @@ class XMRWalletAddrSpec(HiliteStr, InitErrors, MMGenObject):
 				me = str.__new__(cls, f'{arg1}:{arg2}:{arg3}')
 				for arg in [arg1, arg2] + ([] if arg3 is None else [arg3]):
 					assert isinstance(arg, int), f'{arg}: XMRWalletAddrSpec component not of type int'
-					assert arg is None or arg <= 9999, f'{arg}: XMRWalletAddrSpec component greater than 9999'
+					assert arg is None or arg <= 9999, (
+						f'{arg}: XMRWalletAddrSpec component greater than 9999')
 				me.wallet = AddrIdx(arg1)
 				me.account = arg2
 				me.account_address = arg3

+ 2 - 4
mmgen/xmrwallet/ops/__init__.py

@@ -83,15 +83,13 @@ class OpBase:
 				die(1, '{!r}: invalid value for --{}: it must have format {!r}'.format(
 					val,
 					name.replace('_', '-'),
-					uarg_info[name].annot
-				))
+					uarg_info[name].annot))
 
 		for attr in self.cfg.__dict__:
 			if attr in xmrwallet.opts and not attr in self.opts:
 				die(1, 'Option --{} not supported for {!r} operation'.format(
 					attr.replace('_', '-'),
-					self.name,
-				))
+					self.name))
 
 		for opt in xmrwallet.pat_opts:
 			if getattr(self.cfg, opt, None):

+ 1 - 2
mmgen/xmrwallet/ops/export.py

@@ -50,8 +50,7 @@ class OpExportOutputs(OpWallet):
 			parent    = self,
 			wallet_fn = fn,
 			data      = self.c.call('export_outputs', all=True),
-			sign      = self.sign,
-		)
+			sign      = self.sign)
 		m.write()
 		return True
 

+ 4 - 1
mmgen/xmrwallet/ops/import.py

@@ -61,7 +61,10 @@ class OpImportKeyImages(OpWallet):
 		die(2, f'No signed key image files found{rw_msg}!')
 
 	async def process_wallet(self, d, fn, last):
-		keyimage_fn = MoneroWalletOutputsFile.Signed.find_fn_from_wallet_fn(self.cfg, fn, ret_on_no_match=True)
+		keyimage_fn = MoneroWalletOutputsFile.Signed.find_fn_from_wallet_fn(
+			self.cfg,
+			fn,
+			ret_on_no_match = True)
 		if not keyimage_fn:
 			msg(f'No signed key image file found for wallet #{d.idx}')
 			return False

+ 1 - 2
mmgen/xmrwallet/ops/new.py

@@ -47,8 +47,7 @@ class OpNew(OpMixinSpec, OpWallet):
 					a = desc,
 					b = red(str(self.source.idx)),
 					c = '' if desc == 'account' else f', account {red("#"+str(self.account))}',
-					d = 'label ' + pink('‘'+label+'’') if label else 'empty label')
-				):
+					d = 'label ' + pink('‘'+label+'’') if label else 'empty label')):
 
 			if desc == 'address':
 				h.create_new_addr(self.account, label=label)

+ 4 - 6
mmgen/xmrwallet/ops/restore.py

@@ -39,9 +39,9 @@ class OpRestore(OpCreate):
 			match tuple(gen()):
 				case [dump_fn, *rest]:
 					if rest:
-						ymsg(f"Warning: more than one dump file found for '{fn}' - using the first!")
+						ymsg(f'Warning: more than one dump file found for ‘{fn}’ - using the first!')
 				case _:
-					die(1, f"No suitable dump file found for '{fn}'")
+					die(1, f'No suitable dump file found for ‘{fn}’')
 
 			return MoneroWalletDumpFile.Completed(
 				parent = self,
@@ -69,14 +69,12 @@ class OpRestore(OpCreate):
 					self.c.call(
 						'label_address',
 						index = {'major': acct_idx, 'minor': addr_idx},
-						label = addr_data['label'],
-					)
+						label = addr_data['label'])
 
 		def make_format_str():
 			return '    acct {:O>%s}, addr {:O>%s} [{}]' % (
 				len(str(len(data) - 1)),
-				len(str(max(len(acct_data['addresses']) for acct_data in data) - 1))
-			)
+				len(str(max(len(acct_data['addresses']) for acct_data in data) - 1)))
 
 		def check_restored_data():
 			restored_data = h.get_wallet_data(print=False).addrs_data

+ 2 - 4
mmgen/xmrwallet/ops/sign.py

@@ -33,13 +33,11 @@ class OpSign(OpWallet):
 			'sign_transfer',
 			unsigned_txset = tx.data.unsigned_txset,
 			export_raw = True,
-			get_tx_keys = True
-		)
+			get_tx_keys = True)
 		new_tx = MoneroMMGenTX.NewColdSigned(
 			cfg            = self.cfg,
 			txid           = res['tx_hash_list'][0],
 			unsigned_txset = None,
 			signed_txset   = res['signed_txset'],
-			_in_tx         = tx,
-		)
+			_in_tx         = tx)
 		return new_tx

+ 3 - 1
mmgen/xmrwallet/ops/spec.py

@@ -36,7 +36,9 @@ class OpMixinSpec:
 					try:
 						res = self.kal.entry(idx)
 					except:
-						die(1, f'Supplied key-address file does not contain address {self.kal.al_id.sid}:{idx}')
+						die(1,
+							'Supplied key-address file does not contain address '
+							f'{self.kal.al_id.sid}:{idx}')
 					else:
 						setattr(self, k, res)
 						yield res

+ 4 - 6
mmgen/xmrwallet/ops/submit.py

@@ -56,8 +56,7 @@ class OpSubmit(OpWallet):
 			proto       = self.proto,
 			wallet_dir  = self.cfg.wallet_dir or '.',
 			test_suite  = self.cfg.test_suite,
-			monerod_addr = relay_opt[1],
-		)
+			monerod_addr = relay_opt[1])
 
 		u = wd.usr_daemon_args = []
 		if self.cfg.test_suite:
@@ -68,8 +67,7 @@ class OpSubmit(OpWallet):
 		return MoneroWalletRPCClient(
 			cfg             = self.cfg,
 			daemon          = wd,
-			test_connection = False,
-		)
+			test_connection = False)
 
 	async def main(self):
 		tx = self.tx
@@ -104,8 +102,8 @@ class OpSubmit(OpWallet):
 
 		new_tx = MoneroMMGenTX.NewSubmitted(
 			cfg          = self.cfg,
-			_in_tx       = tx,
-		)
+			_in_tx       = tx)
+
 		gmsg('\nOK')
 		new_tx.write(
 			ask_write     = not self.cfg.autosign,

+ 1 - 2
mmgen/xmrwallet/ops/txview.py

@@ -41,8 +41,7 @@ class OpTxview(OpBase):
 		txs = sorted(
 			(MoneroMMGenTX.View(self.cfg, Path(fn)) for fn in files),
 				# old TX files have no ‘submit_time’ field:
-				key = lambda x: getattr(x.data, 'submit_time', None) or x.data.create_time
-		)
+				key = lambda x: getattr(x.data, 'submit_time', None) or x.data.create_time)
 
 		if self.cfg.autosign:
 			self.asi.do_umount()

+ 3 - 1
mmgen/xmrwallet/ops/view.py

@@ -58,7 +58,9 @@ class OpView(OpSync):
 		wallet_height = self.c.call('get_height')['height']
 		msg(f'  Wallet height: {wallet_height}')
 
-		self.wallets_data[fn.name] = MoneroWalletRPC(self, d).get_wallet_data(print=False, skip_empty_ok=True)
+		self.wallets_data[fn.name] = MoneroWalletRPC(self, d).get_wallet_data(
+			print = False,
+			skip_empty_ok = True)
 
 		if not last:
 			self.c.call('close_wallet')