From 36d82c5f91fe19ba350efbe8dc92c589bb6d2f16 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 29 Nov 2025 09:12:49 +0000 Subject: [PATCH] xmrwallet: whitespace --- mmgen/xmrwallet/file/__init__.py | 6 ++---- mmgen/xmrwallet/file/outputs.py | 21 +++++++-------------- mmgen/xmrwallet/include.py | 3 ++- mmgen/xmrwallet/ops/__init__.py | 6 ++---- mmgen/xmrwallet/ops/export.py | 3 +-- mmgen/xmrwallet/ops/import.py | 5 ++++- mmgen/xmrwallet/ops/new.py | 3 +-- mmgen/xmrwallet/ops/restore.py | 10 ++++------ mmgen/xmrwallet/ops/sign.py | 6 ++---- mmgen/xmrwallet/ops/spec.py | 4 +++- mmgen/xmrwallet/ops/submit.py | 10 ++++------ mmgen/xmrwallet/ops/txview.py | 3 +-- mmgen/xmrwallet/ops/view.py | 4 +++- 13 files changed, 36 insertions(+), 48 deletions(-) diff --git a/mmgen/xmrwallet/file/__init__.py b/mmgen/xmrwallet/file/__init__.py index 746941e0..fab9cb23 100755 --- a/mmgen/xmrwallet/file/__init__.py +++ b/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( diff --git a/mmgen/xmrwallet/file/outputs.py b/mmgen/xmrwallet/file/outputs.py index 5024aae1..bf092c6c 100755 --- a/mmgen/xmrwallet/file/outputs.py +++ b/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}' diff --git a/mmgen/xmrwallet/include.py b/mmgen/xmrwallet/include.py index d25eb93e..c45e62c6 100755 --- a/mmgen/xmrwallet/include.py +++ b/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 diff --git a/mmgen/xmrwallet/ops/__init__.py b/mmgen/xmrwallet/ops/__init__.py index 599ddc66..22060d69 100755 --- a/mmgen/xmrwallet/ops/__init__.py +++ b/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): diff --git a/mmgen/xmrwallet/ops/export.py b/mmgen/xmrwallet/ops/export.py index c7d5c7a1..4801b166 100755 --- a/mmgen/xmrwallet/ops/export.py +++ b/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 diff --git a/mmgen/xmrwallet/ops/import.py b/mmgen/xmrwallet/ops/import.py index 32eda45e..6943351d 100755 --- a/mmgen/xmrwallet/ops/import.py +++ b/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 diff --git a/mmgen/xmrwallet/ops/new.py b/mmgen/xmrwallet/ops/new.py index dcc25807..97f74adc 100755 --- a/mmgen/xmrwallet/ops/new.py +++ b/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) diff --git a/mmgen/xmrwallet/ops/restore.py b/mmgen/xmrwallet/ops/restore.py index c957ddd0..a32c3dfd 100755 --- a/mmgen/xmrwallet/ops/restore.py +++ b/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 diff --git a/mmgen/xmrwallet/ops/sign.py b/mmgen/xmrwallet/ops/sign.py index 26926953..9a64b828 100755 --- a/mmgen/xmrwallet/ops/sign.py +++ b/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 diff --git a/mmgen/xmrwallet/ops/spec.py b/mmgen/xmrwallet/ops/spec.py index 37a4c607..0323ac09 100755 --- a/mmgen/xmrwallet/ops/spec.py +++ b/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 diff --git a/mmgen/xmrwallet/ops/submit.py b/mmgen/xmrwallet/ops/submit.py index da9fdd2c..5e11f466 100755 --- a/mmgen/xmrwallet/ops/submit.py +++ b/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, diff --git a/mmgen/xmrwallet/ops/txview.py b/mmgen/xmrwallet/ops/txview.py index f742f87b..3c817d9f 100755 --- a/mmgen/xmrwallet/ops/txview.py +++ b/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() diff --git a/mmgen/xmrwallet/ops/view.py b/mmgen/xmrwallet/ops/view.py index 2e6eab7c..d0e00412 100755 --- a/mmgen/xmrwallet/ops/view.py +++ b/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')