From 4a24d2153c4030fd76084638dcb6880c856a0cb6 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 15 Nov 2025 09:50:21 +0000 Subject: [PATCH] minor whitespace, cleanups --- mmgen/cfg.py | 15 ++++++++++++--- mmgen/opts.py | 6 +++--- mmgen/tw/store.py | 3 ++- test/cmdtest_d/xmr_autosign.py | 11 ++++++----- test/cmdtest_d/xmrwallet.py | 12 +++++------- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/mmgen/cfg.py b/mmgen/cfg.py index db48c248..694c4c1b 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -438,7 +438,7 @@ class Config(Lockable): @property def data_dir(self): """ - location of wallet and other data - same as data_dir_root for mainnet + location of wallet and other data """ if not hasattr(self, '_data_dir'): def make_path(): @@ -554,10 +554,19 @@ class Config(Lockable): self.coin = self.coin.upper() self.token = self.token.upper() if self.token else None - if self.regtest or self.bob or self.alice or self.carol or gc.prog_name == f'{gc.proj_id}-regtest': + if ( + self.regtest or + self.bob or + self.alice or + self.carol or + gc.prog_name == f'{gc.proj_id}-regtest'): if self.coin != 'XMR': self.network = 'regtest' - self.test_user = 'bob' if self.bob else 'alice' if self.alice else 'carol' if self.carol else '' + self.test_user = ( + 'bob' if self.bob else + 'alice' if self.alice else + 'carol' if self.carol else + '') else: self.network = 'testnet' if self.testnet else 'mainnet' diff --git a/mmgen/opts.py b/mmgen/opts.py index a8116566..5fc548b6 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -317,9 +317,9 @@ class UserOpts(Opts): -- --skip-cfg-file Skip reading the configuration file -- --version Print version information and exit -- --usage Print usage information and exit - b- --bob Specify user ‘Bob’ in MMGen regtest mode - b- --alice Specify user ‘Alice’ in MMGen regtest mode - b- --carol Specify user ‘Carol’ in MMGen regtest mode + x- --bob Specify user ‘Bob’ in MMGen regtest or test mode + x- --alice Specify user ‘Alice’ in MMGen regtest or test mode + x- --carol Specify user ‘Carol’ in MMGen regtest or test mode rr COIN-SPECIFIC OPTIONS: rr For descriptions, refer to the non-prefixed versions of these options above rr Prefixed options override their non-prefixed counterparts diff --git a/mmgen/tw/store.py b/mmgen/tw/store.py index 1f19c6af..f90d5171 100755 --- a/mmgen/tw/store.py +++ b/mmgen/tw/store.py @@ -86,7 +86,8 @@ class TwCtlWithStore(TwCtl, metaclass=AsyncInit): cfg.data_dir_root, 'altcoins', proto.coin.lower(), - ('' if proto.network == 'mainnet' else proto.network)) / (cls.tw_subdir or '') + ('' if proto.network == 'mainnet' else proto.network), + (cls.tw_subdir or '')) def upgrade_wallet_maybe(self): pass diff --git a/test/cmdtest_d/xmr_autosign.py b/test/cmdtest_d/xmr_autosign.py index 8bee79cc..9d41db50 100755 --- a/test/cmdtest_d/xmr_autosign.py +++ b/test/cmdtest_d/xmr_autosign.py @@ -39,11 +39,10 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded): # xmrwallet attrs: tx_relay_user = 'miner' - # user sid autosign shift kal_range add_coind_args + # user sid autosign port_shift kal_range add_coind_args user_data = ( ('miner', '98831F3A', False, 130, '1', []), - ('alice', 'FE3C6545', True, 150, '1-2', []), - ) + ('alice', 'FE3C6545', True, 150, '1-2', [])) # autosign attrs: coins = ['xmr'] @@ -179,7 +178,8 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded): t = self.spawn( 'mmgen-xmrwallet', self.extra_opts - + [f'--wallet-dir={data.udir}', f'--daemon=localhost:{data.md.rpc_port}'] + + [f'--wallet-dir={data.udir}'] + + [f'--daemon=localhost:{data.md.rpc_port}'] + (self.autosign_opts if autosign else []) + ['dump'] + ([] if autosign else [get_file_with_ext(data.udir, 'akeys')])) @@ -312,7 +312,8 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded): args = ( self.extra_opts + self.autosign_opts - + [f'--wallet-dir={data.udir}', f'--daemon=localhost:{data.md.rpc_port}'] + + [f'--wallet-dir={data.udir}'] + + [f'--daemon=localhost:{data.md.rpc_port}'] + add_opts + [op] + ([get_file_with_ext(self.asi.xmr_tx_dir, ext)] if ext else []) diff --git a/test/cmdtest_d/xmrwallet.py b/test/cmdtest_d/xmrwallet.py index 14338531..74318515 100755 --- a/test/cmdtest_d/xmrwallet.py +++ b/test/cmdtest_d/xmrwallet.py @@ -293,8 +293,8 @@ class CmdTestXMRWallet(CmdTestBase): run(f'rm -f {glob}', shell=True) t = self.spawn( 'mmgen-xmrwallet', - [f'--wallet-dir={data.udir}'] - + self.extra_opts + self.extra_opts + + [f'--wallet-dir={data.udir}'] + (self.autosign_opts if data.autosign else []) + add_opts + [op] @@ -412,13 +412,11 @@ class CmdTestXMRWallet(CmdTestBase): data = self.users[user] if data.autosign: self.insert_device_online() - cmd_opts = list_gen( - [f'--wallet-dir={data.udir}'], - [f'--daemon=localhost:{data.md.rpc_port}']) t = self.spawn( 'mmgen-xmrwallet', self.extra_opts - + cmd_opts + + [f'--wallet-dir={data.udir}'] + + [f'--daemon=localhost:{data.md.rpc_port}'] + (self.autosign_opts if data.autosign else []) + add_opts + [op] @@ -459,7 +457,6 @@ class CmdTestXMRWallet(CmdTestBase): data = self.users[user] cmd_opts = list_gen( - [f'--wallet-dir={data.udir}'], [f'--outdir={data.udir}', not data.autosign], [f'--daemon=localhost:{data.md.rpc_port}'], [f'--tx-relay-daemon={tx_relay_parm}', tx_relay_parm], @@ -469,6 +466,7 @@ class CmdTestXMRWallet(CmdTestBase): t = self.spawn( 'mmgen-xmrwallet', self.extra_opts + + [f'--wallet-dir={data.udir}'] + cmd_opts + add_opts + (self.autosign_opts if data.autosign else [])