From 7df22cecd95ca7e570a4c5bfccd1d85082d4bf01 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 15 Sep 2026 10:51:03 +0000 Subject: [PATCH] whitespace (hanging closing parenthesis [100 files]) --- examples/coin-daemon-info.py | 7 +++-- examples/halving-calculator.py | 3 +- mmgen/altcoin/params.py | 9 ++---- mmgen/bip_hd/__init__.py | 6 ++-- mmgen/cfg.py | 9 ++---- mmgen/help/help_notes.py | 3 +- mmgen/keygen.py | 3 +- mmgen/main_msg.py | 3 +- mmgen/main_passgen.py | 3 +- mmgen/main_seedjoin.py | 3 +- mmgen/main_xmrwallet.py | 6 ++-- mmgen/msg.py | 6 ++-- mmgen/obj.py | 3 +- mmgen/opts.py | 6 ++-- mmgen/passwdlist.py | 3 +- mmgen/proto/bch/cashaddr.py | 3 +- mmgen/proto/btc/daemon.py | 6 ++-- mmgen/proto/btc/params.py | 3 +- mmgen/proto/btc/rpc/local.py | 9 ++---- mmgen/proto/btc/tw/txhistory.py | 12 +++----- mmgen/proto/btc/tx/completed.py | 3 +- mmgen/proto/btc/tx/info.py | 3 +- mmgen/proto/eth/daemon.py | 12 +++----- mmgen/proto/eth/rpc/local.py | 3 +- mmgen/proto/eth/tw/json.py | 7 ++--- mmgen/proto/eth/tx/info.py | 3 +- mmgen/proto/eth/tx/new.py | 6 ++-- mmgen/proto/xmr/daemon.py | 12 +++----- mmgen/proto/xmr/params.py | 6 ++-- mmgen/proto/xmr/rpc.py | 3 +- mmgen/proto/zec/keygen.py | 3 +- mmgen/protocol.py | 6 ++-- mmgen/seedsplit.py | 6 ++-- mmgen/tool/coin.py | 3 +- mmgen/tool/help.py | 3 +- mmgen/tw/ctl.py | 3 +- mmgen/tx/new.py | 3 +- mmgen/util.py | 3 +- mmgen/util2.py | 6 ++-- mmgen/wallet/mmgen.py | 3 +- scripts/create-bip-hd-chain-params.py | 3 +- scripts/create-token.py | 3 +- scripts/gendiff.py | 3 +- test/cmdtest.py | 3 +- test/cmdtest_d/automount.py | 3 +- test/cmdtest_d/automount_eth.py | 3 +- test/cmdtest_d/autosign.py | 12 +++----- test/cmdtest_d/cfgfile.py | 6 ++-- test/cmdtest_d/chainsplit.py | 3 +- test/cmdtest_d/ethbump.py | 7 ++--- test/cmdtest_d/ethdev.py | 4 +-- test/cmdtest_d/ethswap.py | 7 ++--- test/cmdtest_d/help.py | 3 +- test/cmdtest_d/include/runner.py | 3 +- test/cmdtest_d/input.py | 11 ++++---- test/cmdtest_d/main.py | 7 ++--- test/cmdtest_d/misc.py | 22 ++++++--------- test/cmdtest_d/op_return.py | 4 +-- test/cmdtest_d/opts.py | 3 +- test/cmdtest_d/ref.py | 10 ++----- test/cmdtest_d/ref_3seed.py | 12 +++----- test/cmdtest_d/ref_altcoin.py | 3 +- test/cmdtest_d/regtest.py | 22 ++++++--------- test/cmdtest_d/rune.py | 4 +-- test/cmdtest_d/runeswap.py | 7 ++--- test/cmdtest_d/seedsplit.py | 3 +- test/cmdtest_d/swap.py | 4 +-- test/cmdtest_d/tool.py | 6 ++-- test/cmdtest_d/wallet.py | 3 +- test/cmdtest_d/xmr_autosign.py | 6 ++-- test/cmdtest_d/xmrwallet.py | 25 ++++++++--------- test/daemontest_d/rpc.py | 3 +- test/gentest.py | 6 ++-- test/include/coin_daemon_control.py | 3 +- test/include/common.py | 6 ++-- test/include/ecc.py | 3 +- test/include/unit_test.py | 3 +- test/misc/input_func.py | 2 +- test/misc/term.py | 3 +- test/modtest_d/addrlist.py | 3 +- test/modtest_d/baseconv.py | 3 +- test/modtest_d/bip39.py | 7 ++--- test/modtest_d/bip_hd.py | 12 +++----- test/modtest_d/ecc.py | 6 ++-- test/modtest_d/misc.py | 3 +- test/modtest_d/obj.py | 6 ++-- test/modtest_d/scrypt.py | 3 +- test/modtest_d/seedsplit.py | 3 +- test/modtest_d/util.py | 3 +- test/modtest_d/xmrseed.py | 4 +-- test/objattrtest.py | 3 +- test/objtest.py | 6 ++-- test/objtest_d/btc_mainnet.py | 40 +++++++++------------------ test/objtest_d/btc_testnet.py | 3 +- test/objtest_d/eth_mainnet.py | 6 ++-- test/objtest_d/ltc_mainnet.py | 6 ++-- test/objtest_d/ltc_testnet.py | 6 ++-- test/scrambletest.py | 6 ++-- test/tooltest.py | 6 ++-- test/tooltest2.py | 3 +- 100 files changed, 208 insertions(+), 377 deletions(-) diff --git a/examples/coin-daemon-info.py b/examples/coin-daemon-info.py index 6835389f..e19d4cad 100755 --- a/examples/coin-daemon-info.py +++ b/examples/coin-daemon-info.py @@ -72,15 +72,16 @@ async def main(coins): 'Version', 'Datadir') for coin, rpc in rpcs.items(): - info = ('Down', '-', '-', '-', '-', '-', '-') if rpc is False else ( + info = ( + 'Down', '-', '-', '-', '-', '-', '-' + ) if rpc is False else ( 'Up', rpc.port, rpc.chain, f'{rpc.blockcount:<8} [{make_timestr(rpc.cur_date)}]', rpc.daemon.coind_name, rpc.daemon_version_str, - rpc.daemon.datadir - ) + rpc.daemon.datadir) yield fs.format(coin.upper(), cfgs[coin].network, *info) base_cfg._util.stdout_or_pager('\n'.join(gen_output())) diff --git a/examples/halving-calculator.py b/examples/halving-calculator.py index 706851a5..d43a2dc3 100755 --- a/examples/halving-calculator.py +++ b/examples/halving-calculator.py @@ -84,7 +84,6 @@ async def main(): f'Current block discovery rate (over last {sample_size} blocks): {bdr/60:0.1f} minutes\n' f'Current clock time (UTC): {date(clock_time)}\n' f'Est. halving date (UTC): {date(cur["time"] + t_rem)}\n' - f'Est. time until halving: {dhms(cur["time"] + t_rem - clock_time)}\n' - ) + f'Est. time until halving: {dhms(cur["time"] + t_rem - clock_time)}\n') async_run(cfg, main) diff --git a/mmgen/altcoin/params.py b/mmgen/altcoin/params.py index 5b25bf3f..dc561b1d 100755 --- a/mmgen/altcoin/params.py +++ b/mmgen/altcoin/params.py @@ -191,8 +191,7 @@ class CoinInfo: ce('ZetaCoin', 'ZET', 0xe0, (0x50,'Z'), None, False, 0), ce('ZiftrCoin', 'ZRC', 0xd0, (0x50,'Z'), (0x05,'3'), False, 1), ce('ZLiteQubit', 'ZLQ', 0xe0, (0x26,'G'), None, False, 0), - ce('Zoomcoin', 'ZOOM', 0xe7, (0x67,'i'), (0x5c,'e'), False, 1), - ) + ce('Zoomcoin', 'ZOOM', 0xe7, (0x67,'i'), (0x5c,'e'), False, 1)) coin_constants['testnet'] = ( ce('Bitcoin', 'BTC', 0xef, (0x6f,('m','n')), (0xc4,'2'), True, 5), @@ -204,8 +203,7 @@ class CoinInfo: ce('Feathercoin', 'FTC', 0xc1, (0x41,'T'), (0xc4,'2'), False, 2), ce('Viacoin', 'VIA', 0xff, (0x7f,'t'), (0xc4,'2'), False, 2), ce('Emercoin', 'EMC', 0xef, (0x6f,('m','n')), (0xc4,'2'), False, 2), - ce('Litecoin', 'LTC', 0xef, (0x6f,('m','n')), (0x3a,'Q'), True, 5), # old p2sh: 0xc4 - ) + ce('Litecoin', 'LTC', 0xef, (0x6f,('m','n')), (0x3a,'Q'), True, 5)) # old p2sh: 0xc4 coin_sources = ( ('BTC', 'https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp'), @@ -252,8 +250,7 @@ class CoinInfo: ('OK', 'https://github.com/okcashpro/okcash/blob/master/src/chainparams.cpp'), ('DOGED', 'https://github.com/doged/dogedsource/blob/master/src/base58.h'), ('EFL', 'https://github.com/Electronic-Gulden-Foundation/egulden/blob/master/src/base58.h'), - ('POT', 'https://github.com/potcoin/Potcoin/blob/master/src/base58.h'), - ) + ('POT', 'https://github.com/potcoin/Potcoin/blob/master/src/base58.h')) @classmethod def get_supported_coins(cls, network): diff --git a/mmgen/bip_hd/__init__.py b/mmgen/bip_hd/__init__.py index 21ce9c7a..43d06f5b 100755 --- a/mmgen/bip_hd/__init__.py +++ b/mmgen/bip_hd/__init__.py @@ -232,8 +232,7 @@ class BipHDNode(Lockable): raise ValueError( '{}: invalid value for ‘{}’ at depth {} ({!r}) (must be {})'.format( val, name, self.depth, self.desc, - 'None' if getattr(cls, name) is None else f'None or {getattr(cls, name)}') - ) + 'None' if getattr(cls, name) is None else f'None or {getattr(cls, name)}')) def set_params(self, cfg, idx, *, hardened): self.check_param('idx', idx) @@ -310,8 +309,7 @@ class BipHDNode(Lockable): length = 4, byteorder = 'big') + self.chaincode - + (self.pubkey_bytes if public else b'\x00' + self.key) - ) + + (self.pubkey_bytes if public else b'\x00' + self.key)) return ret if as_str else Bip32ExtendedKey(ret) def derive_public(self, idx=None): diff --git a/mmgen/cfg.py b/mmgen/cfg.py index e6b90238..ca6016d1 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -769,11 +769,9 @@ def check_opts(cfg): # Raises exception if any check fails + ( f'parameter for command-line option {fmt_opt(name)!r}' if name in cfg._uopts and cfg._uopt_src == 'cmdline' else - f'value for configuration option {name!r}' - ) + f'value for configuration option {name!r}') + (' from environment' if name in cfg._envopts else '') - + (f' in {cfg._cfgfile_fn!r}' if name in cfg._cfgfile_opts.non_auto else '') - ) + + (f' in {cfg._cfgfile_fn!r}' if name in cfg._cfgfile_opts.non_auto else '')) def display_opt(name, val='', *, beg='For selected', end=':\n'): from .util import msg_r @@ -966,8 +964,7 @@ def conv_type(name, val, refval, *, src, invert_bool=False): ret = ( True if v in ('true', 'yes', '1', 'on') else False if v in ('false', 'no', 'none', '0', 'off', '') else - None - ) + None) return do_fail() if ret is None else (not ret) if invert_bool else ret elif isinstance(refval, list | tuple): if src == 'cmdline': diff --git a/mmgen/help/help_notes.py b/mmgen/help/help_notes.py index 3f835bc1..d8c5cea0 100755 --- a/mmgen/help/help_notes.py +++ b/mmgen/help/help_notes.py @@ -140,8 +140,7 @@ FMT CODES: from ..keygen import get_backends from ..addr import MMGenAddrType backends = get_backends( - MMGenAddrType(self.proto, self.cfg.type or self.proto.dfl_mmtype).pubkey_type - ) + MMGenAddrType(self.proto, self.cfg.type or self.proto.dfl_mmtype).pubkey_type) return ' '.join('{n}:{k}{t}'.format(n=n, k=k, t=('', ' [default]')[n == 1]) for n, k in enumerate(backends, 1)) diff --git a/mmgen/keygen.py b/mmgen/keygen.py index 7e050ae9..6eeb5d0a 100755 --- a/mmgen/keygen.py +++ b/mmgen/keygen.py @@ -81,8 +81,7 @@ def _check_backend(cfg, backend, pubkey_type, *, desc='keygen backend'): die(1, f'{backend}: {desc} out of range\n' + 'Configured backends: ' + - ' '.join(f'{n}:{k}' for n, k in enumerate(backends, 1)) - ) + ' '.join(f'{n}:{k}' for n, k in enumerate(backends, 1))) cfg._util.qmsg(f'Using backend {backends[int(backend)-1]!r} for public key generation') diff --git a/mmgen/main_msg.py b/mmgen/main_msg.py index 1c3970bb..85f1cd66 100755 --- a/mmgen/main_msg.py +++ b/mmgen/main_msg.py @@ -192,8 +192,7 @@ $ mmgen-msg verify signatures.json }, 'code': { 'notes': lambda help_notes, s: s.format( - n_at = help_notes('address_types'), - ) + n_at = help_notes('address_types')) } } diff --git a/mmgen/main_passgen.py b/mmgen/main_passgen.py index 48777946..b95ff69a 100755 --- a/mmgen/main_passgen.py +++ b/mmgen/main_passgen.py @@ -124,8 +124,7 @@ EXAMPLES: n_bw = help_notes('brainwallet'), n_pf = help_notes('password_formats'), n_fc = help_notes('fmt_codes'), - gc = gc, - ) + gc = gc) } } diff --git a/mmgen/main_seedjoin.py b/mmgen/main_seedjoin.py index 4648b9ee..a5d9cf6e 100755 --- a/mmgen/main_seedjoin.py +++ b/mmgen/main_seedjoin.py @@ -82,8 +82,7 @@ For usage examples, see the help screen for the 'mmgen-seedsplit' command. ), 'notes': lambda cfg, help_notes, s: s.format( n_fc = help_notes('fmt_codes'), - n_pw = help_notes('passwd'), - ) + n_pw = help_notes('passwd')) } } diff --git a/mmgen/main_xmrwallet.py b/mmgen/main_xmrwallet.py index 61826a4c..55f2b8fb 100755 --- a/mmgen/main_xmrwallet.py +++ b/mmgen/main_xmrwallet.py @@ -98,8 +98,7 @@ opts_data = { tp = fmt_dict(xmrwallet.tx_priorities, fmt='equal_compact') ), 'notes': lambda help_mod, s: s.format( - n_xw = help_mod('xmrwallet') - ) + n_xw = help_mod('xmrwallet')) } } @@ -110,8 +109,7 @@ cmd_args = cfg._args if cmd_args and cfg.autosign and ( 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') ): cmd_args.insert(1, None) diff --git a/mmgen/msg.py b/mmgen/msg.py index 93658802..eaa1bef3 100755 --- a/mmgen/msg.py +++ b/mmgen/msg.py @@ -340,15 +340,13 @@ class coin_msg: get_data_from_file( cfg = self.cfg, infile = infile, - desc = self.desc) - ) + desc = self.desc)) pfx = self.msg_cls.sigdata_pfx self.sigs = {sig_data['addr']: sig_data for sig_data in ( [{k: v[len(pfx):] for k, v in e.items()} for e in self.data['signatures']] if pfx else - self.data['signatures'] - )} + self.data['signatures'])} def _get_obj(clsname, cfg, *args, coin=None, network='mainnet', infile=None, data=None, **kwargs): diff --git a/mmgen/obj.py b/mmgen/obj.py index 49c09d85..3da5c648 100755 --- a/mmgen/obj.py +++ b/mmgen/obj.py @@ -193,8 +193,7 @@ class MMGenListItem(MMGenObject): self.__dict__['valid_attrs'] = self.valid_attrs or ( {e for e in dir(self) if e[0] != '_'} - MMGenListItem.invalid_attrs - - self.invalid_attrs - ) + - self.invalid_attrs) if args: raise ValueError(f'Non-keyword args not allowed in {type(self).__name__!r} constructor') diff --git a/mmgen/opts.py b/mmgen/opts.py index 2e60c9d9..dc36d721 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -183,8 +183,7 @@ def parse_opts(cfg, opts_data, global_opts_data, global_filter_codes, *, need_pr return namedtuple('parsed_cmd_opts', ['user_opts', 'cmd_args', 'opts'])( uopts, # dict uargs, # list, callers can pop - tuple(v.name for k, v in opts if len(k) > 1) - ) + tuple(v.name for k, v in opts if len(k) > 1)) def opt_preproc_debug(po): d = ( @@ -192,8 +191,7 @@ def opt_preproc_debug(po): ('Filtered opts', po.filtered_opts, False), ('User-selected opts', po.user_opts, False), ('Cmd args', po.cmd_args, False), - ('Opts', po.opts, True), - ) + ('Opts', po.opts, True)) from .util import Msg, fmt_list Msg('\n=== opts.py debug ===') for label, data, pretty in d: diff --git a/mmgen/passwdlist.py b/mmgen/passwdlist.py index a676b51b..51c7b8f0 100755 --- a/mmgen/passwdlist.py +++ b/mmgen/passwdlist.py @@ -184,8 +184,7 @@ class PasswordList(AddrList): die(1, f'Cannot generate passwords with more entropy than underlying seed! ({len(seed.data)*8} bits)\n' + (f'Re-run the command with --passwd-len={good_pw_len}' if self.pw_fmt in ('bip39', 'hex') else - 'Re-run the command, specifying a password length of {} or less') - ) + 'Re-run the command, specifying a password length of {} or less')) case x if x < seed.byte_len and self.pw_fmt in ('bip39', 'hex'): from .ui import keypress_confirm keypress_confirm( diff --git a/mmgen/proto/bch/cashaddr.py b/mmgen/proto/bch/cashaddr.py index 86a349f7..69af848b 100755 --- a/mmgen/proto/bch/cashaddr.py +++ b/mmgen/proto/bch/cashaddr.py @@ -72,8 +72,7 @@ def cashaddr_encode_addr(addr_type, size, pfx, data): t = namedtuple('encoded_cashaddr', ['addr', 'pfx', 'payload']) payload_bin = ( '{:08b}'.format(make_ver_byte(addr_type, size * 8)) + - '{:0{w}b}'.format(int.from_bytes(data, 'big'), w=len(data) * 8) - ) + '{:0{w}b}'.format(int.from_bytes(data, 'big'), w=len(data) * 8)) payload_vec = bin2vec(payload_bin + '0' * (-len(payload_bin) % 5)) chksum_vec = bin2vec('{:040b}'.format(PolyMod(make_polymod_vec(pfx, payload_vec + [0] * 8)))) payload = ''.join(b32a[i] for i in payload_vec + chksum_vec) diff --git a/mmgen/proto/btc/daemon.py b/mmgen/proto/btc/daemon.py index e1204c92..b9ad79a9 100755 --- a/mmgen/proto/btc/daemon.py +++ b/mmgen/proto/btc/daemon.py @@ -67,8 +67,7 @@ class bitcoin_core_daemon(CoinDaemon): [f'--rpcuser={self.rpc_user}', self.network == 'regtest'], [f'--rpcpassword={self.rpc_password}', self.network == 'regtest'], ['--testnet', self.network == 'testnet'], - ['--regtest', self.network == 'regtest'], - ) + ['--regtest', self.network == 'regtest']) self.coind_args = list_gen( ['--listen=0'], @@ -81,8 +80,7 @@ class bitcoin_core_daemon(CoinDaemon): ['--deprecatedrpc=create_bdb', self.coin == 'BTC' and self.opt.bdb_wallet], ['--mempoolreplacement=1', self.coin == 'LTC'], ['--txindex=1', self.coin == 'LTC' or self.network == 'regtest'], - ['--addresstype=bech32', self.coin == 'LTC' and self.network == 'regtest'], - ) + ['--addresstype=bech32', self.coin == 'LTC' and self.network == 'regtest']) self.lockfile = os.path.join(self.network_datadir, '.cookie') diff --git a/mmgen/proto/btc/params.py b/mmgen/proto/btc/params.py index 3c3388e1..a2a3cf90 100755 --- a/mmgen/proto/btc/params.py +++ b/mmgen/proto/btc/params.py @@ -64,8 +64,7 @@ class mainnet(CoinProtocol.Secp256k1): # chainparams.cpp 'rpc_password', 'tw_name', 'max_tx_fee', - 'cashaddr', - ) + 'cashaddr') def encode_wif(self, privbytes, pubkey_type, *, compressed): # input is preprocessed assert pubkey_type in self.wif_ver_bytes, f'{pubkey_type!r}: invalid pubkey_type' diff --git a/mmgen/proto/btc/rpc/local.py b/mmgen/proto/btc/rpc/local.py index 7a434df0..65afc1a0 100755 --- a/mmgen/proto/btc/rpc/local.py +++ b/mmgen/proto/btc/rpc/local.py @@ -240,8 +240,7 @@ class BitcoinRPCClient(RPCClient, metaclass=AsyncInit): ('getnetworkinfo', ()), ('getblockchaininfo', ()), ] + ( - [('getdeploymentinfo', ())] if 'deployment_info' in self.caps else [] - ) + [('getdeploymentinfo', ())] if 'deployment_info' in self.caps else []) ( self.blockcount, @@ -252,8 +251,7 @@ class BitcoinRPCClient(RPCClient, metaclass=AsyncInit): ) = ( await self.gathered_call(None, tuple(call_group)) ) + ( - [] if 'deployment_info' in self.caps else [None] - ) + [] if 'deployment_info' in self.caps else [None]) self.daemon_version = self.cached['networkinfo']['version'] self.daemon_version_str = self.cached['networkinfo']['subversion'] @@ -449,5 +447,4 @@ class BitcoinRPCClient(RPCClient, metaclass=AsyncInit): 'signrawtransaction', 'signrawtransactionwithkey', # method new to Core v0.17.0 'validateaddress', - 'walletpassphrase', - ) + 'walletpassphrase') diff --git a/mmgen/proto/btc/tw/txhistory.py b/mmgen/proto/btc/tw/txhistory.py index 7a22ff0a..7644b74c 100755 --- a/mmgen/proto/btc/tw/txhistory.py +++ b/mmgen/proto/btc/tw/txhistory.py @@ -87,8 +87,7 @@ class BitcoinTwTransaction: mmid = e.twlabel.twmmid yield ( (mmid if mmid.type == 'mmgen' else mmid.split(':', 1)[1]) + - ('*' if mmid in self.unspent_info else '') - ) + ('*' if mmid in self.unspent_info else '')) else: yield e.coin_addr @@ -311,15 +310,13 @@ class BitcoinTwTxHistory(BitcoinTwView, TwTxHistory, BitcoinTwRPC): mm_map = { i['address']: ( _mmp(TwMMGenID(self.proto, i['twmmid']), TwComment(i['comment'])) - if i['twmmid'] else _mmp(None, None) - ) + if i['twmmid'] else _mmp(None, None)) for i in data if 'address' in i} if self.sinceblock: # mapping data may be incomplete for inputs, so update from 'listlabels' mm_map.update( {e.coinaddr: _mmp(e.label.mmid, e.label.comment) if e.label else _mmp(None, None) - for e in await self.get_label_addr_pairs()} - ) + for e in await self.get_label_addr_pairs()}) msg_r('Getting wallet transactions...') _wallet_txs = await self.rpc.gathered_icall( @@ -364,8 +361,7 @@ class BitcoinTwTxHistory(BitcoinTwView, TwTxHistory, BitcoinTwRPC): (data, 'txhist'), (mm_map, 'mmap'), (_prevout_txs, 'prevout-txs'), - (txdata, 'txdata'), - ) + (txdata, 'txdata')) unspent_info = await self.get_unspent_by_mmid() diff --git a/mmgen/proto/btc/tx/completed.py b/mmgen/proto/btc/tx/completed.py index 6d1f3aab..23b70f2c 100755 --- a/mmgen/proto/btc/tx/completed.py +++ b/mmgen/proto/btc/tx/completed.py @@ -67,8 +67,7 @@ class Completed(Base, TxBase.Completed): @property def send_amt(self): return self.sum_outputs( - exclude = None if len(self.nondata_outputs) == 1 else self.chg_idx - ) + exclude = None if len(self.nondata_outputs) == 1 else self.chg_idx) def check_txfile_hex_data(self): self.serialized = HexStr(self.serialized) diff --git a/mmgen/proto/btc/tx/info.py b/mmgen/proto/btc/tx/info.py index 845e7c19..3572898a 100755 --- a/mmgen/proto/btc/tx/info.py +++ b/mmgen/proto/btc/tx/info.py @@ -34,8 +34,7 @@ class TxInfo(TxInfo): return ' ({} {}, {} of spend amount)'.format( pink(tx.fee_abs2rel(tx.fee)), tx.rel_fee_disp, - pink('{:0.6f}%'.format(tx.fee / tx.send_amt * 100)) - ) + pink('{:0.6f}%'.format(tx.fee / tx.send_amt * 100))) def format_abs_fee(self, iwidth, /, *, color=None): return self.tx.fee.fmt(iwidth, color=color) diff --git a/mmgen/proto/eth/daemon.py b/mmgen/proto/eth/daemon.py index 2c2a431d..e2fe8e3a 100755 --- a/mmgen/proto/eth/daemon.py +++ b/mmgen/proto/eth/daemon.py @@ -83,8 +83,7 @@ class openethereum_daemon(ethereum_daemon): ['--mode=offline', self.test_suite or self.network=='regtest'], [f'--log-file={self.logfile}', self.non_dfl_datadir], ['daemon', self.use_pidfile], - [self.pidfile, self.use_pidfile], - ) + [self.pidfile, self.use_pidfile]) class parity_daemon(openethereum_daemon): daemon_data = _dd('Parity', 2007002, '2.7.2') @@ -126,8 +125,7 @@ class geth_daemon(ethereum_daemon): [f'--datadir={self.datadir}', self.non_dfl_datadir], ['--holesky', self.network=='testnet' and self.id == 'geth'], ['--chain=holesky', self.network=='testnet' and self.id == 'reth'], - ['--dev', self.network=='regtest'], - ) + ['--dev', self.network=='regtest']) class reth_daemon(geth_daemon): daemon_data = _dd('Reth', 2005001, '2.5.1') @@ -163,8 +161,7 @@ class erigon_daemon(geth_daemon): ['--chain=goerli', self.network=='testnet'], [f'--torrent.port={self.torrent_ports.testnet}', self.network=='testnet'], ['--chain=dev', self.network=='regtest'], - ['--mine', self.network=='regtest'], - ) + ['--mine', self.network=='regtest']) self.rpc_d = erigon_rpcdaemon( cfg = self.cfg, @@ -212,5 +209,4 @@ class erigon_rpcdaemon(RPCDaemon): [f'--private.api.addr=127.0.0.1:{private_port}'], [f'--http.port={self.rpc_port}'], [f'--datadir={self.datadir}'], - ['--http.api=eth,erigon,web3,net,debug,trace,txpool,parity'], - ) + ['--http.api=eth,erigon,web3,net,debug,trace,txpool,parity']) diff --git a/mmgen/proto/eth/rpc/local.py b/mmgen/proto/eth/rpc/local.py index 5b77c4c2..cbb85513 100755 --- a/mmgen/proto/eth/rpc/local.py +++ b/mmgen/proto/eth/rpc/local.py @@ -119,5 +119,4 @@ class EthereumRPCClient(RPCClient, metaclass=AsyncInit): 'parity_chain', 'parity_nodeKind', 'parity_pendingTransactions', - 'txpool_content', # Geth and friends only - ) + 'txpool_content') # Geth and friends only diff --git a/mmgen/proto/eth/tw/json.py b/mmgen/proto/eth/tw/json.py index f2537999..0df4cdea 100755 --- a/mmgen/proto/eth/tw/json.py +++ b/mmgen/proto/eth/tw/json.py @@ -76,8 +76,7 @@ class EthereumTwJSON(TwJSON): for token_addr, token_data in edata['tokens'].items(): yield ( token_addr, - list(gen_entries(token_data)), - ) + list(gen_entries(token_data))) return { 'accounts': list(gen_entries(edata['accounts'])), @@ -123,9 +122,7 @@ class EthereumTwJSON(TwJSON): token_addr, sorted( gen_data(token_data), - key = lambda x: x.mmgen_id.sort_key if hasattr(x, 'mmgen_id') else '+' - ) - ) + key = lambda x: x.mmgen_id.sort_key if hasattr(x, 'mmgen_id') else '+')) return { 'accounts': sorted( diff --git a/mmgen/proto/eth/tx/info.py b/mmgen/proto/eth/tx/info.py index 6ac1b61c..ca3e375a 100755 --- a/mmgen/proto/eth/tx/info.py +++ b/mmgen/proto/eth/tx/info.py @@ -58,8 +58,7 @@ class TxInfo(VmTxInfo, TxInfo): def format_rel_fee(self): return ' ({} of spend amount)'.format( - pink('{:0.6f}%'.format(self.tx.fee / self.tx.send_amt * 100)) - ) + pink('{:0.6f}%'.format(self.tx.fee / self.tx.send_amt * 100))) def format_verbose_footer(self): if self.tx.txobj['data'] and not self.tx.is_swap: diff --git a/mmgen/proto/eth/tx/new.py b/mmgen/proto/eth/tx/new.py index 4370b6ab..3d2b2ceb 100755 --- a/mmgen/proto/eth/tx/new.py +++ b/mmgen/proto/eth/tx/new.py @@ -198,11 +198,9 @@ class TokenNew(TokenBase, New): def final_inputs_ok_msg(self, funds_left): token_bal = ( self.proto.coin_amt('0') if self.outputs[0].is_chg - else self.inputs[0].amt - self.outputs[0].amt - ) + else self.inputs[0].amt - self.outputs[0].amt) return "Transaction leaves ≈{} {} and {} {} in the sender's account".format( funds_left.hl(), self.proto.coin, token_bal.hl(), - self.proto.dcoin - ) + self.proto.dcoin) diff --git a/mmgen/proto/xmr/daemon.py b/mmgen/proto/xmr/daemon.py index 0e7e81b7..1a3f5369 100755 --- a/mmgen/proto/xmr/daemon.py +++ b/mmgen/proto/xmr/daemon.py @@ -59,8 +59,7 @@ class monero_daemon(CoinDaemon): ['--no-zmq'], [f'--p2p-bind-port={self.p2p_port}', self.p2p_port], [f'--rpc-bind-port={self.rpc_port}'], - ['--stagenet', self.network == 'testnet'], - ) + ['--stagenet', self.network == 'testnet']) self.coind_args = list_gen( ['--hide-my-port'], @@ -68,8 +67,7 @@ class monero_daemon(CoinDaemon): [f'--data-dir={self.datadir}', self.non_dfl_datadir], [f'--pidfile={self.pidfile}', self.use_pidfile], ['--detach', not (self.opt.no_daemonize or gc.platform=='win32')], - ['--offline', not self.opt.online], - ) + ['--offline', not self.opt.online]) @property def stop_cmd(self): @@ -144,8 +142,7 @@ class MoneroWalletDaemon(RPCDaemon): CoinDaemon( cfg = self.cfg, proto = proto, - test_suite = test_suite).rpc_port - ) + test_suite = test_suite).rpc_port) if test_monerod and self.monerod_port: import socket @@ -178,8 +175,7 @@ class MoneroWalletDaemon(RPCDaemon): [f'--pidfile={self.pidfile}', gc.platform == 'linux'], ['--detach', not (self.opt.no_daemonize or gc.platform=='win32')], ['--stagenet', self.network == 'testnet'], - ['--allow-mismatched-daemon-version', test_suite], - ) + ['--allow-mismatched-daemon-version', test_suite]) from .rpc import MoneroWalletRPCClient self.rpc = MoneroWalletRPCClient( diff --git a/mmgen/proto/xmr/params.py b/mmgen/proto/xmr/params.py index 122ab9a1..eda57adb 100755 --- a/mmgen/proto/xmr/params.py +++ b/mmgen/proto/xmr/params.py @@ -44,8 +44,7 @@ class mainnet(CoinProtocol.RPC, CoinProtocol.DummyWIF, CoinProtocol.Base): coin_cfg_opts = ( 'ignore_daemon_version', - 'rpc_port', - ) + 'rpc_port') def get_addr_len(self, addr_fmt): return (64, 72)[addr_fmt == 'monero_integrated'] @@ -81,8 +80,7 @@ class mainnet(CoinProtocol.RPC, CoinProtocol.DummyWIF, CoinProtocol.Base): return parsed_addr( ver_bytes = ver_bytes, data = addr_bytes[:addr_len], - payment_id = addr_bytes[addr_len:] if fmt == 'monero_integrated' else None, - ) + payment_id = addr_bytes[addr_len:] if fmt == 'monero_integrated' else None) def pubhash2addr(self, *args, **kwargs): raise NotImplementedError('Monero addresses do not support pubhash2addr()') diff --git a/mmgen/proto/xmr/rpc.py b/mmgen/proto/xmr/rpc.py index ea081f93..17a9bc89 100755 --- a/mmgen/proto/xmr/rpc.py +++ b/mmgen/proto/xmr/rpc.py @@ -123,8 +123,7 @@ class MoneroWalletRPCClient(MoneroRPCClient): 'close_wallet', # filename,password,seed (restore_height,language,seed_offset,autosave_current) 'restore_deterministic_wallet', - 'refresh', # start_height - ) + 'refresh') # start_height def call_raw(self, *args, **kwargs): raise NotImplementedError('call_raw() not implemented for class MoneroWalletRPCClient') diff --git a/mmgen/proto/zec/keygen.py b/mmgen/proto/zec/keygen.py index f8f10cd1..735beb6d 100755 --- a/mmgen/proto/zec/keygen.py +++ b/mmgen/proto/zec/keygen.py @@ -36,8 +36,7 @@ class backend: return PubKey( self.zhash256(privkey, 0) + self.crypto_scalarmult_base(self.zhash256(privkey, 1)), - compressed = privkey.compressed - ) + compressed = privkey.compressed) def to_viewkey(self, privkey): vk = bytearray(self.zhash256(privkey, 0) + self.zhash256(privkey, 1)) diff --git a/mmgen/protocol.py b/mmgen/protocol.py index 30d05beb..de3e2163 100755 --- a/mmgen/protocol.py +++ b/mmgen/protocol.py @@ -249,8 +249,7 @@ class CoinProtocol(MMGenObject): def parse_addr(self, ver_bytes, addr_bytes, fmt): return parsed_addr( ver_bytes = ver_bytes, - data = addr_bytes, - ) + data = addr_bytes) def preprocess_key(self, sec, pubkey_type): # Key must be non-zero and less than group order of secp256k1 curve @@ -324,8 +323,7 @@ def init_proto( setattr( CoinProtocol, proto_name, - getattr(importlib.import_module(f'mmgen.proto.{coin}.params'), network) - ) + getattr(importlib.import_module(f'mmgen.proto.{coin}.params'), network)) if return_cls: return getattr(CoinProtocol, proto_name) diff --git a/mmgen/seedsplit.py b/mmgen/seedsplit.py index b866216b..b55f17ba 100755 --- a/mmgen/seedsplit.py +++ b/mmgen/seedsplit.py @@ -210,13 +210,11 @@ class SeedShare(SeedShareBase, SubSeed): f'{parent_list.split_type}:{parent_list.id_str}:'.encode() + parent_list.count.to_bytes(2, 'big') + idx.to_bytes(2, 'big') + - nonce.to_bytes(2, 'big') - ) + nonce.to_bytes(2, 'big')) if parent_list.master_share: scramble_key += ( b':master:' + - parent_list.master_share.idx.to_bytes(2, 'big') - ) + parent_list.master_share.idx.to_bytes(2, 'big')) return Crypto(parent_list.parent_seed.cfg).scramble_seed(seed.data, scramble_key)[:seed.byte_len] class SeedShareLast(SeedShareBase, SeedBase): diff --git a/mmgen/tool/coin.py b/mmgen/tool/coin.py index eee7c7be..2164c1dc 100755 --- a/mmgen/tool/coin.py +++ b/mmgen/tool/coin.py @@ -46,8 +46,7 @@ class tool_cmd(tool_cmd_base): def _init_generators(self): return generator_data( kg = KeyGenerator(self.cfg, self.proto, self.mmtype.pubkey_type), - ag = AddrGenerator(self.cfg, self.proto, self.mmtype), - ) + ag = AddrGenerator(self.cfg, self.proto, self.mmtype)) def randwif(self): "generate a random private key in WIF format" diff --git a/mmgen/tool/help.py b/mmgen/tool/help.py index 6b11347f..ac5fbc9a 100755 --- a/mmgen/tool/help.py +++ b/mmgen/tool/help.py @@ -52,8 +52,7 @@ def main_help(): pretty_format( code.__doc__.strip().split('\n')[0].strip(), width = 79-(max_w+7), - pfx = ' '*(max_w+5)).lstrip() - ) + pfx = ' '*(max_w+5)).lstrip()) yield '' return '\n'.join(do()) diff --git a/mmgen/tw/ctl.py b/mmgen/tw/ctl.py index 15183c9b..7de3515e 100755 --- a/mmgen/tw/ctl.py +++ b/mmgen/tw/ctl.py @@ -177,8 +177,7 @@ class TwCtl(MMGenObject, metaclass=AsyncInit): fs = '{:%s}: {:%s} {:%s} - OK' % ( len(str(len(fdata))) * 2 + 1, max(len(d.addr) for d in fdata), - max(len(d.mmid_disp) for d in fdata) + 2 - ) + max(len(d.mmid_disp) for d in fdata) + 2) nAddrs = len(data) out = [( # create list, not generator, so we know data is valid before starting import diff --git a/mmgen/tx/new.py b/mmgen/tx/new.py index 8b66c096..727b5009 100755 --- a/mmgen/tx/new.py +++ b/mmgen/tx/new.py @@ -285,8 +285,7 @@ class New(Base): addrfile_args = remove_dups( tuple(a for a in args if get_extension(a) == AddrFile.ext), desc = 'command line', - edesc = 'argument', - ) + edesc = 'argument') cmd_args = tuple(a for a in args if a not in addrfile_args) if not self.is_swap: cmd_args = remove_dups(cmd_args, desc='command line', edesc='argument') diff --git a/mmgen/util.py b/mmgen/util.py index 8d405c4e..b12b8ed5 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -348,8 +348,7 @@ def secs_to_dhms(secs): ('{} day{}, '.format(hrs//24, suf(hrs//24)) if hrs > 24 else ''), hrs % 24, (secs // 60) % 60, - secs % 60 - ) + secs % 60) def secs_to_hms(secs): return '{:02d}:{:02d}:{:02d}'.format(secs//3600, (secs//60) % 60, secs % 60) diff --git a/mmgen/util2.py b/mmgen/util2.py index 4f443b1e..d30fcba1 100755 --- a/mmgen/util2.py +++ b/mmgen/util2.py @@ -180,8 +180,7 @@ def format_elapsed_hr( ((' ago' if rel_now else '') if e > 0 else (f' {future_msg}' if rel_now else ' (negative elapsed)')) if (abs_e if show_secs else abs_e // 60) else - ('just now' if rel_now else ('0 ' + ('seconds' if show_secs else 'minutes'))) - ) + ('just now' if rel_now else ('0 ' + ('seconds' if show_secs else 'minutes')))) abs_e = abs(e) data = ( ('day', abs_e // 86400), @@ -191,8 +190,7 @@ def format_elapsed_hr( ) if show_secs else ( ('day', abs_e // 86400), ('hour', abs_e // 3600 % 24), - ('minute', abs_e // 60 % 60), - ) + ('minute', abs_e // 60 % 60)) cached[key] = ' '.join(f'{n} {desc}{suf(n)}' for desc, n in data if n) + add_suffix() return cached[key] diff --git a/mmgen/wallet/mmgen.py b/mmgen/wallet/mmgen.py index 6d969ba5..17f21a83 100755 --- a/mmgen/wallet/mmgen.py +++ b/mmgen/wallet/mmgen.py @@ -89,8 +89,7 @@ class wallet(wallet): '{} {} {} {} {}'.format(s.sid.lower(), d.key_id.lower(), s.bitlen, d.pw_status, d.timestamp), '{}: {} {} {}'.format(d.hash_preset, *self.crypto.get_hash_params(d.hash_preset)), '{} {}'.format(make_chksum_6(slt_fmt), split_into_cols(4, slt_fmt)), - '{} {}'.format(make_chksum_6(es_fmt), split_into_cols(4, es_fmt)) - ) + '{} {}'.format(make_chksum_6(es_fmt), split_into_cols(4, es_fmt))) chksum = make_chksum_6(' '.join(lines).encode()) self.fmt_data = '\n'.join((chksum,)+lines) + '\n' diff --git a/scripts/create-bip-hd-chain-params.py b/scripts/create-bip-hd-chain-params.py index 105c3078..dd7f5d2c 100755 --- a/scripts/create-bip-hd-chain-params.py +++ b/scripts/create-bip-hd-chain-params.py @@ -57,8 +57,7 @@ def get_bip_utils_data(bipnum, n): 'x' if vb_pub == dfl_vb_pub else vb_pub, v.m_wif_net_ver.hex() if isinstance(v.m_wif_net_ver, bytes) else '-', ap['net_ver'].hex() if 'net_ver' in ap else 'h:'+ap['hrp'] if 'hrp' in ap else 'spec' if ap else '-', - 'x' if v.m_def_path == dfl_dfl_path else v.m_def_path, - ) + 'x' if v.m_def_path == dfl_dfl_path else v.m_def_path) def gen(): diff --git a/scripts/create-token.py b/scripts/create-token.py index d662d6c7..e2e203de 100755 --- a/scripts/create-token.py +++ b/scripts/create-token.py @@ -85,8 +85,7 @@ def create_src(cfg, template, token_data): val = ( getattr(cfg, k) or getattr(field, 'default', None) - or die(1, f'The --{k} option must be specified') - ) + or die(1, f'The --{k} option must be specified')) if not field.test(val): die(1, f'{val!r}: invalid parameter for option --{k}') diff --git a/scripts/gendiff.py b/scripts/gendiff.py index 6321940a..ac4a0bbd 100755 --- a/scripts/gendiff.py +++ b/scripts/gendiff.py @@ -65,5 +65,4 @@ if len(fns) == 2: '\n'.join(a.rstrip() for a in unified_diff( *cleaned_texts, fromfile = f'a/{fns[0]}', - tofile = f'b/{fns[1]}')) - ) + tofile = f'b/{fns[1]}'))) diff --git a/test/cmdtest.py b/test/cmdtest.py index 2c9dbbd1..2a9515ce 100755 --- a/test/cmdtest.py +++ b/test/cmdtest.py @@ -182,8 +182,7 @@ environment var }, 'code': { 'options': lambda proto, help_notes, s: s.format( - lf = cmdtest_py_log_fn - ) + lf = cmdtest_py_log_fn) } } diff --git a/test/cmdtest_d/automount.py b/test/cmdtest_d/automount.py index e628affa..e9363ae5 100755 --- a/test/cmdtest_d/automount.py +++ b/test/cmdtest_d/automount.py @@ -94,8 +94,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest): ('wait_loop_kill', 'stopping autosign wait loop'), ('stop', 'stopping regtest daemon'), ('txview', 'viewing transactions on removable device'), - ('txview_forbid_legacy', 'viewing transactions on removable device (forbid legacy files'), - ) + ('txview_forbid_legacy', 'viewing transactions on removable device (forbid legacy files')) def __init__(self, cfg, trunner, cfgs, spawn): diff --git a/test/cmdtest_d/automount_eth.py b/test/cmdtest_d/automount_eth.py index 774f27db..bc1dc402 100755 --- a/test/cmdtest_d/automount_eth.py +++ b/test/cmdtest_d/automount_eth.py @@ -49,8 +49,7 @@ class CmdTestAutosignETH(CmdTestAutosignThreaded, CmdTestEthdev, CmdTestEthdevMe ('token_bal2', f'the {cfg.coin} balance and token balance'), ('wait_loop_kill', 'stopping autosign wait loop'), ('stop', 'stopping daemon'), - ('autosign_txview', 'viewing transactions on removable device'), - ) + ('autosign_txview', 'viewing transactions on removable device')) def __init__(self, cfg, trunner, cfgs, spawn): diff --git a/test/cmdtest_d/autosign.py b/test/cmdtest_d/autosign.py index 8ea82205..05c20ddc 100755 --- a/test/cmdtest_d/autosign.py +++ b/test/cmdtest_d/autosign.py @@ -391,8 +391,7 @@ class CmdTestAutosignClean(CmdTestAutosignBase): cmd_group = ( ('clean_no_xmr', 'cleaning signable file directories (no XMR)'), ('clean_xmr_only', 'cleaning signable file directories (XMR-only)'), - ('clean_all', 'cleaning signable file directories (with XMR)'), - ) + ('clean_all', 'cleaning signable file directories (with XMR)')) def create_fake_tx_files(self): imsg('Creating fake transaction files') @@ -736,8 +735,7 @@ class CmdTestAutosign(CmdTestAutosignBase): ('sign_no_unsigned_xmronly', 'signing transactions and messages (nothing to sign, XMR-only)'), ('stop_daemons', 'stopping daemons'), ('sign_bad_no_daemon', 'signing transactions (error, no daemons running)'), - ('wipe_key', 'wiping the wallet encryption key'), - ) + ('wipe_key', 'wiping the wallet encryption key')) def __init__(self, cfg, trunner, cfgs, spawn): @@ -785,8 +783,7 @@ class CmdTestAutosign(CmdTestAutosignBase): f'--outdir={self.cfg.data_dir}', '--usr-randchars=0', '--quiet', '--hash-preset=1', '--label=foo', 'test/ref/98831F3A.hex' - ] - ) + ]) t.passphrase_new('new MMGen wallet', self.wallet_passwd) t.written_to_file('MMGen wallet') return t @@ -1054,8 +1051,7 @@ class CmdTestAutosignLive(CmdTestAutosignBTC): ('sign_live_led', 'signing transactions (--led)'), ('remove_bad_txfiles', 'removing bad transaction files'), ('sign_live_stealth_led', 'signing transactions (--stealth-led)'), - ('stop_daemons', 'stopping daemons'), - ) + ('stop_daemons', 'stopping daemons')) def __init__(self, cfg, trunner, cfgs, spawn): diff --git a/test/cmdtest_d/cfgfile.py b/test/cmdtest_d/cfgfile.py index 07ecd5b6..8f51456f 100755 --- a/test/cmdtest_d/cfgfile.py +++ b/test/cmdtest_d/cfgfile.py @@ -42,8 +42,7 @@ class CmdTestCfgFile(CmdTestBase): ('chain_names', (40, 'setting chain names', [])), ('mnemonic_entry_modes', (40, 'setting mnemonic entry modes', [])), ('opt_override1', (40, 'cfg file opts not overridden', [])), - ('opt_override2', (40, 'negative cmdline opts overriding cfg file opts', [])), - ) + ('opt_override2', (40, 'negative cmdline opts overriding cfg file opts', []))) def __init__(self, cfg, trunner, cfgs, spawn): CmdTestBase.__init__(self, cfg, trunner, cfgs, spawn) @@ -134,8 +133,7 @@ class CmdTestCfgFile(CmdTestBase): d = ( self.read_from_cfgfile('sys').replace('monero_', 'zcash_').splitlines() + ['', '# Uncomment to make foo true:', '# foo true'] - + ['', '# Uncomment to make bar false:', '# bar false'] - ) + + ['', '# Uncomment to make bar false:', '# bar false']) self.write_to_cfgfile('sample', d + cfg_file_sample.cls_make_metadata(d)) t = self.spawn_test(args=args, pexpect_spawn=pexpect_spawn, exit_val=1 if old_set else None) diff --git a/test/cmdtest_d/chainsplit.py b/test/cmdtest_d/chainsplit.py index 43b4b1c8..8c17e9dd 100755 --- a/test/cmdtest_d/chainsplit.py +++ b/test/cmdtest_d/chainsplit.py @@ -49,8 +49,7 @@ class CmdTestChainsplit(CmdTestRegtest): ('split_txdo_timelock_bad_btc', 'sending transaction with bad locktime (BTC)'), ('split_txdo_timelock_good_btc', 'sending transaction with good locktime (BTC)'), ('split_txdo_timelock_bad_b2x', 'sending transaction with bad locktime (B2X)'), - ('split_txdo_timelock_good_b2x', 'sending transaction with good locktime (B2X)'), - ) + ('split_txdo_timelock_good_b2x', 'sending transaction with good locktime (B2X)')) def split_setup(self): if self.proto.coin != 'BTC': diff --git a/test/cmdtest_d/ethbump.py b/test/cmdtest_d/ethbump.py index 71152ba2..5c68cfaa 100755 --- a/test/cmdtest_d/ethbump.py +++ b/test/cmdtest_d/ethbump.py @@ -142,8 +142,8 @@ class CmdTestEthBump(CmdTestEthBumpMethods, CmdTestEthSwapMethods, CmdTestSwapMe ('subgroup.token_new_outputs_swap', ['token_init_swap']), ('ltc_stop', ''), ('swap_server_stop', 'stopping the Thornode server'), - ('stop', 'stopping daemon'), - ) + ('stop', 'stopping daemon')) + cmd_subgroups = { 'eth_init': ( 'initializing ETH tracking wallet', @@ -444,5 +444,4 @@ class CmdTestEthBumpLTC(CmdTestSwapMethods, CmdTestRegtest): ('walletconv_bob', 'LTC wallet generation'), ('addrgen_bob', 'LTC address generation'), ('addrimport_bob', 'importing LTC addresses'), - ('stop', 'stopping the Litecoin daemon'), - ) + ('stop', 'stopping the Litecoin daemon')) diff --git a/test/cmdtest_d/ethdev.py b/test/cmdtest_d/ethdev.py index f796015a..c110a039 100755 --- a/test/cmdtest_d/ethdev.py +++ b/test/cmdtest_d/ethdev.py @@ -495,8 +495,8 @@ class CmdTestEthdev(CmdTestEthdevMethods, CmdTestBase, CmdTestShared): ('subgroup.view', ['cached']), ('subgroup.label', ['cached']), ('subgroup.remove', ['cached']), - ('stop', 'stopping daemon'), - ) + ('stop', 'stopping daemon')) + cmd_subgroups = { 'misc': ( 'miscellaneous commands', diff --git a/test/cmdtest_d/ethswap.py b/test/cmdtest_d/ethswap.py index 07c277d1..ffee13e5 100755 --- a/test/cmdtest_d/ethswap.py +++ b/test/cmdtest_d/ethswap.py @@ -142,8 +142,8 @@ class CmdTestEthSwap(CmdTestSwapMethods, CmdTestRegtest): ('subgroup.eth_token_swap', ['fund', 'token_init']), ('swap_server_stop', 'stopping the Thornode server'), ('eth_stop', 'stopping the Ethereum daemon'), - ('stop', 'stopping the regtest daemon'), - ) + ('stop', 'stopping the regtest daemon')) + cmd_subgroups = { 'init': ( 'creating Bob’s MMGen wallet and tracking wallet', @@ -378,8 +378,7 @@ class CmdTestEthSwapEth(CmdTestEthSwapMethods, CmdTestSwapMethods, CmdTestEthdev ('swaptxsend5a', 'sending the transaction via Etherscan (p1)'), ('swaptxsend5b', 'sending the transaction via Etherscan (p2)'), ('swaptxsend5', 'sending the transaction via Etherscan (complete)'), - ('etherscan_server_stop', 'stopping the Etherscan server'), - ) + ('etherscan_server_stop', 'stopping the Etherscan server')) def fund_mmgen_addr1b(self): return self._fund_mmgen_addr(arg=f'{dfl_sid}:E:3,0.001') diff --git a/test/cmdtest_d/help.py b/test/cmdtest_d/help.py index bf02b453..f99edf28 100755 --- a/test/cmdtest_d/help.py +++ b/test/cmdtest_d/help.py @@ -36,8 +36,7 @@ class CmdTestHelp(CmdTestBase): ('tool_help', (1, '‘mmgen-tool’ usage screen', [])), ('tool_cmd_usage', (1, '‘mmgen-tool’ usage screen', [])), ('test_help', (1, '‘cmdtest.py’ help screens', [])), - ('tooltest_help', (1, '‘tooltest.py’ help screens', [])), - ) + ('tooltest_help', (1, '‘tooltest.py’ help screens', []))) def usage1(self): return self._usage('walletgen', ['--usage'], True, False, 0) diff --git a/test/cmdtest_d/include/runner.py b/test/cmdtest_d/include/runner.py index 66dd4a00..3c0b3b94 100755 --- a/test/cmdtest_d/include/runner.py +++ b/test/cmdtest_d/include/runner.py @@ -196,8 +196,7 @@ class CmdTestRunner: clr1, clr2 = (nocolor, nocolor) if self.cfg.print_cmdline else (green, cyan) omsg( clr1('Executing: ') + - clr2(repr(cmd_disp) if gc.platform == 'win32' else cmd_disp) - ) + clr2(repr(cmd_disp) if gc.platform == 'win32' else cmd_disp)) else: omsg_r('{a}Testing {b}: {c}'.format( a = t_pfx, diff --git a/test/cmdtest_d/input.py b/test/cmdtest_d/input.py index 3aca6fac..142e37b1 100755 --- a/test/cmdtest_d/input.py +++ b/test/cmdtest_d/input.py @@ -36,6 +36,7 @@ class CmdTestInput(CmdTestBase): networks = ('btc',) tmpdir_nums = [1] color = True + cmd_group_in = ( ('subgroup.char', []), ('subgroup.line', []), @@ -43,8 +44,8 @@ class CmdTestInput(CmdTestBase): ('subgroup.misc', []), ('subgroup.wallet', []), ('subgroup.mnemonic', []), - ('subgroup.dieroll', []), - ) + ('subgroup.dieroll', [])) + cmd_subgroups = { 'char': ( 'get_char() function', @@ -103,8 +104,7 @@ class CmdTestInput(CmdTestBase): 'dieroll': ( 'dieroll entry', ('dieroll_entry', 'dieroll entry (base6d)'), - ('dieroll_entry_usrrand', 'dieroll entry (base6d) with added user entropy'), - ) + ('dieroll_entry_usrrand', 'dieroll entry (base6d) with added user entropy')) } def clean_env_spawn(self, cmd, cmd_args, *args, **kwargs): @@ -479,8 +479,7 @@ class CmdTestInput(CmdTestBase): 'mmgen-walletconv', ['--usr-randchars=10', '--stdout'] + (['--seed-len=128'] if seedlen_opt else []) - + [f'--in-fmt={fmt}', f'--out-fmt={out_fmt or fmt}'] - ) + + [f'--in-fmt={fmt}', f'--out-fmt={out_fmt or fmt}']) t.expect(f'{capfirst(wcls.base_type or wcls.type)} type:.*{wcls.mn_type}', regex=True) if not seedlen_opt: t.expect(wcls.choose_seedlen_prompt, '1') diff --git a/test/cmdtest_d/main.py b/test/cmdtest_d/main.py index 4582922f..d5f2cfa0 100755 --- a/test/cmdtest_d/main.py +++ b/test/cmdtest_d/main.py @@ -333,8 +333,8 @@ class CmdTestMain(CmdTestBase, CmdTestShared): ), ('txsign6', (21, 'transaction signing with corrected vsize', [[['mmdat', 'rawtx'], 21]]) - ), - ) + )) + segwit_do = ( 'walletgen1', 'addrgen1', @@ -372,8 +372,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): 'walletgen6', 'addrgen6', 'txcreate6', - 'txsign6', - ) + 'txsign6') def __init__(self, cfg, trunner, cfgs, spawn): CmdTestBase.__init__(self, cfg, trunner, cfgs, spawn) diff --git a/test/cmdtest_d/misc.py b/test/cmdtest_d/misc.py index cb2325a6..7567310d 100755 --- a/test/cmdtest_d/misc.py +++ b/test/cmdtest_d/misc.py @@ -33,12 +33,11 @@ from .main import CmdTestMain class CmdTestDev(CmdTestBase): 'developer scripts' networks = ('btc',) - cmd_group = ( - ('compute_file_chksum', 'scripts/compute-file-chksum.py'), - ('create_bip_hd_chain_params', 'scripts/create-bip-hd-chain-params.py'), - ) tmpdir_nums = [99] color = True + cmd_group = ( + ('compute_file_chksum', 'scripts/compute-file-chksum.py'), + ('create_bip_hd_chain_params', 'scripts/create-bip-hd-chain-params.py')) def _spawn(self, script, args): return self.spawn(script, args, cmd_dir='.', no_exec_wrapper=True) @@ -63,6 +62,8 @@ class CmdTestMisc(CmdTestBase): networks = ('btc',) tmpdir_nums = [99] passthru_opts = ('daemon_data_dir', 'rpc_port') + color = True + need_daemon = True cmd_group = ( ('rpc_backends', 'RPC backends'), ('bch_txview_legacy1', '‘mmgen-tool --coin=bch --cashaddr=0 txview terse=0’'), @@ -74,10 +75,7 @@ class CmdTestMisc(CmdTestBase): ('coin_daemon_info', '‘examples/coin-daemon-info.py’'), ('examples_bip_hd', '‘examples/bip_hd.py’'), ('term_echo', 'term.set("echo")'), - ('term_cleanup', 'term.register_cleanup()'), - ) - need_daemon = True - color = True + ('term_cleanup', 'term.register_cleanup()')) def rpc_backends(self): backends = self.cfg._autoset_opts['rpc_backend'][1] @@ -187,15 +185,14 @@ class CmdTestMisc(CmdTestBase): class CmdTestOutput(CmdTestBase): 'screen output' networks = ('btc',) + color = True cmd_group = ( ('output_gr', (1, 'Greek text', [])), ('output_ru', (1, 'Russian text', [])), ('output_zh', (1, 'Chinese text', [])), ('output_jp', (1, 'Japanese text', [])), ('oneshot_warning', (1, 'Oneshot warnings', [])), - ('oneshot_warning_term', (1, 'Oneshot warnings (pexpect_spawn)', [])) - ) - color = True + ('oneshot_warning_term', (1, 'Oneshot warnings (pexpect_spawn)', []))) def screen_output(self, lang): return self.spawn('test/misc/utf8_output.py', [lang], cmd_dir='.') @@ -253,8 +250,7 @@ class CmdTestCreateRefTX(CmdTestMain, CmdTestBase): ('ref_tx_txcreate', (31, 'transaction creation', ([['addrs'], 31], [['addrs'], 32], [['addrs'], 33], [['addrs'], 34])) - ), - ) + )) def __init__(self, cfg, trunner, cfgs, spawn): if cfgs: diff --git a/test/cmdtest_d/op_return.py b/test/cmdtest_d/op_return.py index 5f0f9cc4..11420433 100755 --- a/test/cmdtest_d/op_return.py +++ b/test/cmdtest_d/op_return.py @@ -29,8 +29,8 @@ class CmdTestOpReturn(CmdTestRegtest): cmd_group_in = ( ('subgroup.init_data', []), ('subgroup.data', ['init_data']), - ('stop', 'stopping regtest daemon'), - ) + ('stop', 'stopping regtest daemon')) + cmd_subgroups = { 'init_data': ( 'Initialize regtest setup for OP_RETURN data operations', diff --git a/test/cmdtest_d/opts.py b/test/cmdtest_d/opts.py index 04e83643..99e92fcd 100755 --- a/test/cmdtest_d/opts.py +++ b/test/cmdtest_d/opts.py @@ -95,8 +95,7 @@ class CmdTestOpts(CmdTestBase): ('opt_invalid_31', (41, 'invalid cmdline opt (--bch-cashaddr without --coin=bch)', [])), ('opt_invalid_32', (41, 'invalid cmdline opt (--eth-chain-names without --coin=eth)', [])), ('opt_invalid_33', (41, 'invalid cmdline opt (--xmr-rpc-host)', [])), - ('opt_invalid_34', (41, 'invalid cmdline opt (--eth-rpc-user)', [])), - ) + ('opt_invalid_34', (41, 'invalid cmdline opt (--eth-rpc-user)', []))) def spawn_prog(self, args, opts=[], exit_val=None, need_proto=False): return self.spawn( diff --git a/test/cmdtest_d/ref.py b/test/cmdtest_d/ref.py index 6e54f583..8d15892d 100755 --- a/test/cmdtest_d/ref.py +++ b/test/cmdtest_d/ref.py @@ -127,12 +127,9 @@ class CmdTestRef(CmdTestBase, CmdTestShared): ('ref_passwdfile_chk_bip39_24', 'saved reference password file (BIP39, 24 words)'), ('ref_passwdfile_chk_xmrseed_25', 'saved reference password file (Monero new-style mnemonic, 25 words)'), ('ref_passwdfile_chk_hex2bip39_12', 'saved reference password file (hex-to-BIP39, 12 words)'), - -# Create the fake inputs: -# ('txcreate8', 'transaction creation (8)'), +# ('txcreate8', 'transaction creation (8)'), # create the fake inputs ('ref_brain_chk_spc3', 'saved brainwallet (non-standard spacing)'), - ('ref_dieroll_chk_seedtruncate', 'saved dieroll wallet with extra entropy bits'), - ) + ('ref_dieroll_chk_seedtruncate', 'saved dieroll wallet with extra entropy bits')) @property def nw_desc(self): @@ -302,8 +299,7 @@ class CmdTestRefTX(CmdTestRef): ('ref_txfile_mismatched_forbidden', 'viewing an out-of-date tx file (forbidden)'), ('ref_txfile_mismatched_allowed', 'viewing an out-of-date tx file (allowed)'), ('ref_txfile_mismatched_forbidden_nover', 'viewing an out-of-date tx file (forbidden, no version)'), - ('ref_txfile_mismatched_allowed_nover', 'viewing an out-of-date tx file (allowed, no version)'), - ) + ('ref_txfile_mismatched_allowed_nover', 'viewing an out-of-date tx file (allowed, no version)')) sources = { 'ref_tx_file': { # data shared with ref_altcoin, autosign diff --git a/test/cmdtest_d/ref_3seed.py b/test/cmdtest_d/ref_3seed.py index dadc25b6..9aca02ec 100755 --- a/test/cmdtest_d/ref_3seed.py +++ b/test/cmdtest_d/ref_3seed.py @@ -53,8 +53,7 @@ class CmdTestRef3Seed(CmdTestBase, CmdTestShared): shared_deps = ['mmdat', pwfile] skip_cmds = ( 'ref_xmrseed_25_passwdgen_1', - 'ref_xmrseed_25_passwdgen_2', - ) + 'ref_xmrseed_25_passwdgen_2') cmd_group = ( # reading saved reference wallets ('ref_wallet_chk', 'saved reference wallet'), @@ -76,8 +75,7 @@ class CmdTestRef3Seed(CmdTestBase, CmdTestShared): ('ref_walletconv_plainhexseed', 'wallet filename (plain hex seed)'), ('ref_walletconv_dieroll', 'wallet filename (dieroll (b6d) seed)'), ('ref_walletconv_incog', 'wallet filename (incog)'), - ('ref_walletconv_hexincog', 'wallet filename (hex incog)'), - ) + ('ref_walletconv_hexincog', 'wallet filename (hex incog)')) def __init__(self, cfg, trunner, cfgs, spawn): for k, _ in self.cmd_group: @@ -356,8 +354,7 @@ class CmdTestRef3Addr(CmdTestRef3Seed): ('refkeyaddrgen_compressed', 'new refwallet key-addr chksum (compressed)'), ('refkeyaddrgen_segwit', 'new refwallet key-addr chksum (segwit)'), ('refkeyaddrgen_bech32', 'new refwallet key-addr chksum (bech32)'), - ('refkeyaddrgen_bech32pk', 'new refwallet key-addr chksum (bech32pk)'), - ) + ('refkeyaddrgen_bech32pk', 'new refwallet key-addr chksum (bech32pk)')) def call_addrgen(self, mmtype, name='addrgen'): if self.coin in self.chk_data[self.test_name]: @@ -444,8 +441,7 @@ class CmdTestRef3Passwd(CmdTestRef3Seed): ('ref_bip39_18_passwdgen', 'new refwallet passwd file chksum (BIP39, up to 18 words)'), ('ref_bip39_24_passwdgen', 'new refwallet passwd file chksum (BIP39, up to 24 words)'), ('ref_xmrseed_25_passwdgen', 'new refwallet passwd file chksum (Monero 25-word mnemonic)'), - ('ref_hex2bip39_24_passwdgen', 'new refwallet passwd file chksum (hex-to-BIP39, up to 24 words)'), - ) + ('ref_hex2bip39_24_passwdgen', 'new refwallet passwd file chksum (hex-to-BIP39, up to 24 words)')) def pwgen(self, ftype, id_str, pwfmt=None, pwlen=None, extra_opts=[], stdout=False): wf = self.get_file_with_ext('mmdat') diff --git a/test/cmdtest_d/ref_altcoin.py b/test/cmdtest_d/ref_altcoin.py index 478949d5..6f60e10c 100755 --- a/test/cmdtest_d/ref_altcoin.py +++ b/test/cmdtest_d/ref_altcoin.py @@ -80,8 +80,7 @@ class CmdTestRefAltcoin(CmdTestRef, CmdTestBase): ('ref_keyaddrfile_chk_zec', 'reference key-address file (ZEC-T)'), ('ref_keyaddrfile_chk_zec_z', 'reference key-address file (ZEC-Z)'), ('ref_keyaddrfile_chk_xmr', 'reference key-address file (XMR)'), - ('ref_viewkeyaddrfile_chk_xmr', 'reference viewkey-address file (XMR)'), - ) + ('ref_viewkeyaddrfile_chk_xmr', 'reference viewkey-address file (XMR)')) def ref_altcoin_tx_chk(self): """ diff --git a/test/cmdtest_d/regtest.py b/test/cmdtest_d/regtest.py index 5240af02..00774d50 100755 --- a/test/cmdtest_d/regtest.py +++ b/test/cmdtest_d/regtest.py @@ -192,8 +192,8 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared): ('subgroup.auto_chg', ['_auto_chg_deps']), ('subgroup.dump_hex', ['fund_users']), ('subgroup.sort', ['init_bob']), - ('stop', 'stopping regtest daemon'), - ) + ('stop', 'stopping regtest daemon')) + cmd_subgroups = { 'misc': ( 'miscellaneous commands', @@ -1065,8 +1065,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared): cmp_or_die( ' '.join(bals[k]), ' '.join(ret.split()), - desc = k, - ) + desc = k) return t def bob_0conf0_getbalance(self): @@ -1800,8 +1799,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared): f'--outdir={self.tr.trash_dir}', 'listaddresses', 'interactive=1', - ] - ) + ]) prompt = 'abel:\b' t.expect(prompt, 'p') ret = t.expect([prompt, 'to confirm: ']) @@ -1834,8 +1832,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared): [rf'[{b32a}]{{8}}'], [prompt, 'h'], [rf'[{b58a}]{{8}}'], - [prompt, 'q'] - ) + [prompt, 'q']) return self._alice_listaddresses_interactive(expect=expect) def alice_listaddresses_empty(self): @@ -2046,8 +2043,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared): def bob_msgverify_export(self): return self.bob_msgverify( - msgfile = os.path.join(self.tmpdir, 'signatures.json') - ) + msgfile = os.path.join(self.tmpdir, 'signatures.json')) def bob_msgverify_export_single(self): sid = self._user_sid('bob') @@ -2059,8 +2055,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared): t.close() return self.bob_msgverify( addr = addr, - msgfile = os.path.join(self.tmpdir, 'signatures.json') - ) + msgfile = os.path.join(self.tmpdir, 'signatures.json')) def bob_auto_chg_split(self): if not self.proto.cap('segwit'): @@ -2096,8 +2091,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared): + (['--autochg-ignore-labels'] if ignore_labels else []) + [mmtype if by_mmtype else f'{sid}:{mmtype}'] + ([self.burn_addr+',0.01'] if include_dest else []) - + add_args - ) + + add_args) return self.txcreate_ui_common(t, menu = [], inputs = '1', diff --git a/test/cmdtest_d/rune.py b/test/cmdtest_d/rune.py index 3ef1af32..14493960 100755 --- a/test/cmdtest_d/rune.py +++ b/test/cmdtest_d/rune.py @@ -90,8 +90,8 @@ class CmdTestRune(CmdTestRuneMethods, CmdTestEthdevMethods, CmdTestBase, CmdTest cmd_group_in = ( ('subgroup.init', []), ('subgroup.main', ['init']), - ('rpc_server_stop', 'stopping the Thornode RPC server'), - ) + ('rpc_server_stop', 'stopping the Thornode RPC server')) + cmd_subgroups = { 'init': ( 'initializing wallets', diff --git a/test/cmdtest_d/runeswap.py b/test/cmdtest_d/runeswap.py index 8a4c1bb3..0f080925 100755 --- a/test/cmdtest_d/runeswap.py +++ b/test/cmdtest_d/runeswap.py @@ -40,8 +40,8 @@ class CmdTestRuneSwap(CmdTestSwapMethods, CmdTestRegtest): ('subgroup.rune_swap', ['rune_init']), ('rune_rpc_server_stop', 'stopping the Thornode RPC server'), ('swap_server_stop', 'stopping the Thornode swap server'), - ('stop', 'stopping the regtest daemon'), - ) + ('stop', 'stopping the regtest daemon')) + cmd_subgroups = { 'init': ( 'creating Bob’s MMGen wallet and tracking wallet', @@ -101,8 +101,7 @@ class CmdTestRuneSwapRune(CmdTestSwapMethods, CmdTestRune): ('swaptxstatus1', 'getting the transaction status'), ('swaptxreceipt1', 'getting the transaction receipt'), ('swaptxhex1', 'dumping the transaction hex'), - ('thornode_server_stop', 'stopping Thornode server'), - ) + ('thornode_server_stop', 'stopping Thornode server')) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/test/cmdtest_d/seedsplit.py b/test/cmdtest_d/seedsplit.py index ede1f45d..23c4d57c 100755 --- a/test/cmdtest_d/seedsplit.py +++ b/test/cmdtest_d/seedsplit.py @@ -80,8 +80,7 @@ class CmdTestSeedSplit(CmdTestBase): ('ss_bad_invocation8', 'bad invocation of ‘mmgen-seedjoin’ - nonexistent file'), ('ss_bad_invocation9', 'bad invocation of ‘mmgen-seedsplit’ - bad specifier'), ('ss_bad_invocation10', 'bad invocation of ‘mmgen-seedsplit’ - nonexistent file'), - ('ss_bad_invocation11', 'bad invocation of ‘mmgen-seedsplit’ - invalid file extension'), - ) + ('ss_bad_invocation11', 'bad invocation of ‘mmgen-seedsplit’ - invalid file extension')) def get_tmp_subdir(self, subdir): return os.path.join(self.tmpdir, subdir) diff --git a/test/cmdtest_d/swap.py b/test/cmdtest_d/swap.py index 1b243c4a..2fab8754 100755 --- a/test/cmdtest_d/swap.py +++ b/test/cmdtest_d/swap.py @@ -294,8 +294,8 @@ class CmdTestSwap( ('subgroup.signsend_bad', ['init_swap']), ('subgroup.autosign', ['signsend']), ('swap_server_stop', 'stopping the Thornode swap server'), - ('stop', 'stopping regtest daemons'), - ) + ('stop', 'stopping regtest daemons')) + cmd_subgroups = { 'init_swap': ( 'Initialize regtest setup for swap operations', diff --git a/test/cmdtest_d/tool.py b/test/cmdtest_d/tool.py index 96cb187e..88bb064e 100755 --- a/test/cmdtest_d/tool.py +++ b/test/cmdtest_d/tool.py @@ -72,9 +72,8 @@ class CmdTestTool(CmdTestMain, CmdTestBase): ), ('tool_api', (9, 'tool API (initialization, config methods, wif2addr)', []) - ), + )) # ('tool_encrypt_ref', (9, '‘mmgen-tool encrypt’ (reference text)', [])), - ) def tool_rand2file(self): from mmgen.util2 import parse_bytespec @@ -82,8 +81,7 @@ class CmdTestTool(CmdTestMain, CmdTestBase): t = self.spawn( 'mmgen-tool', ['-d', self.tmpdir, '-r0', 'rand2file', 'rand2file.out', nbytes], - extra_desc='({} byte{})'.format(nbytes, suf(parse_bytespec(nbytes))) - ) + extra_desc='({} byte{})'.format(nbytes, suf(parse_bytespec(nbytes)))) t.expect('random data written to file') t.read() t.p.wait() diff --git a/test/cmdtest_d/wallet.py b/test/cmdtest_d/wallet.py index 375d2cac..7fd2a347 100755 --- a/test/cmdtest_d/wallet.py +++ b/test/cmdtest_d/wallet.py @@ -86,8 +86,7 @@ class CmdTestWalletConv(CmdTestBase, CmdTestShared): ('ref_incog_conv_out', 'ref seed conversion to incog data'), ('ref_incox_conv_out', 'ref seed conversion to hex incog data'), ('ref_hincog_conv_out', 'ref seed conversion to hidden incog data'), - ('ref_hincog_blkdev_conv_out', 'ref seed conversion to hidden incog data on block device') - ) + ('ref_hincog_blkdev_conv_out', 'ref seed conversion to hidden incog data on block device')) def __init__(self, cfg, trunner, cfgs, spawn): for k, _ in self.cmd_group: diff --git a/test/cmdtest_d/xmr_autosign.py b/test/cmdtest_d/xmr_autosign.py index f05a3307..99c0971c 100755 --- a/test/cmdtest_d/xmr_autosign.py +++ b/test/cmdtest_d/xmr_autosign.py @@ -102,8 +102,7 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded): ('txlist', 'listing Alice’s submitted transactions'), ('txview', 'viewing Alice’s submitted transactions'), ('txview_all', 'viewing all raw, signed and submitted transactions'), - ('check_tx_dirs', 'cleaning and checking signable file directories'), - ) + ('check_tx_dirs', 'cleaning and checking signable file directories')) def __init__(self, cfg, trunner, cfgs, spawn): @@ -590,8 +589,7 @@ class CmdTestXMRCompat(CmdTestXMRAutosign): ('alice_newaddr2', 'adding address to Alice’s tracking wallet (no timestr)'), ('alice_newaddr3', 'adding address to Alice’s tracking wallet (dfl label)'), ('alice_newaddr4', 'adding address to Alice’s tracking wallet (dfl label, no timestr)'), - ('stop_daemons', 'stopping all wallet and coin daemons'), - ) + ('stop_daemons', 'stopping all wallet and coin daemons')) def __init__(self, cfg, trunner, cfgs, spawn): super().__init__(cfg, trunner, cfgs, spawn) diff --git a/test/cmdtest_d/xmrwallet.py b/test/cmdtest_d/xmrwallet.py index ef72fb4c..80a3deb4 100755 --- a/test/cmdtest_d/xmrwallet.py +++ b/test/cmdtest_d/xmrwallet.py @@ -72,8 +72,7 @@ class CmdTestXMRWallet(CmdTestBase): user_data = ( ('miner', '98831F3A', False, 130, '1-2', []), ('alice', 'FE3C6545', False, 150, '1-4', []), - ('bob', '1378FC64', False, 140, None, ['--restricted-rpc']), - ) + ('bob', '1378FC64', False, 140, None, ['--restricted-rpc'])) tx_relay_user = 'bob' daemon_datadir_base = os.path.join('test', 'daemons', 'xmrtest') compat = False @@ -112,8 +111,7 @@ class CmdTestXMRWallet(CmdTestBase): ('sweep_create_and_send', 'sweeping to new account (create TX + send TX, in stages)'), ('list_wallets_all', 'listing wallets'), - ('stop_daemons', 'stopping all wallet and coin daemons'), - ) + ('stop_daemons', 'stopping all wallet and coin daemons')) def __init__(self, cfg, trunner, cfgs, spawn): CmdTestBase.__init__(self, cfg, trunner, cfgs, spawn) @@ -201,8 +199,8 @@ class CmdTestXMRWallet(CmdTestBase): test_suite = True, port_shift = shift, opts = ['online'], - datadir = daemon_datadir - ) + datadir = daemon_datadir) + md_rpc = MoneroRPCClient( cfg = self.cfg, proto = self.proto, @@ -211,8 +209,8 @@ class CmdTestXMRWallet(CmdTestBase): user = None, passwd = None, test_connection = False, - daemon = md, - ) + daemon = md) + wd = MoneroWalletDaemon( cfg = self.cfg, proto = self.proto, @@ -221,13 +219,13 @@ class CmdTestXMRWallet(CmdTestBase): user = 'foo', passwd = 'bar', port_shift = shift, - monerod_addr = f'127.0.0.1:{md.rpc_port}', - ) + monerod_addr = f'127.0.0.1:{md.rpc_port}') + wd_rpc = MoneroWalletRPCClient( cfg = self.cfg, daemon = wd, - test_connection = False, - ) + test_connection = False) + if autosign: kafile_suf = 'vkeys' fn_stem = 'MoneroWatchOnlyWallet' @@ -749,8 +747,7 @@ class CmdTestXMRWallet(CmdTestBase): await self.transfer( 'miner', 123456789, - t.randpair()[1], - ) + t.randpair()[1]) imsg_r(f'{i+1} ') oqmsg_r('+') await asyncio.sleep(0.5) diff --git a/test/daemontest_d/rpc.py b/test/daemontest_d/rpc.py index 4377d3d3..702f71ef 100755 --- a/test/daemontest_d/rpc.py +++ b/test/daemontest_d/rpc.py @@ -229,8 +229,7 @@ class unit_tests: port = md.rpc_port, user = None, passwd = None, - daemon = md, - ) + daemon = md) if cfg.verbose: await print_daemon_info(rpc) rpc.call_raw('get_height') diff --git a/test/gentest.py b/test/gentest.py index 3f008e4d..cf7413b4 100755 --- a/test/gentest.py +++ b/test/gentest.py @@ -371,8 +371,7 @@ def do_ab_test(proto, scfg, addr_type, gen1, kg2, ag, tool, cache_data): int.to_bytes(group_order - 1, 32, 'big'), # bitcoin will not reduce bytes([0x00]*31 + [0xff]), # monero will reduce bytes([0xff]*31 + [0x0f]), # monero will not reduce - bytes.fromhex('deadbeef'*8), - ) + bytes.fromhex('deadbeef'*8)) qmsg(purple('edge cases:')) for i, privbytes in enumerate(edgecase_sks): @@ -447,8 +446,7 @@ def speed_test(proto, kg, ag, rounds): qmsg( f'\rRound {i+1}/{rounds} ' + f'\n{rounds} addresses generated' + - ('' if cfg.test_suite_deterministic else f' in {time.time()-start:.2f} seconds') - ) + ('' if cfg.test_suite_deterministic else f' in {time.time()-start:.2f} seconds')) def dump_test(proto, kg, ag, filename): diff --git a/test/include/coin_daemon_control.py b/test/include/coin_daemon_control.py index 1051b1ed..0c8cc801 100755 --- a/test/include/coin_daemon_control.py +++ b/test/include/coin_daemon_control.py @@ -62,8 +62,7 @@ Valid network IDs: {nid}, {xmrw_nid}, all, no_xmr pn = gc.prog_name), 'notes': lambda s, help_notes: s.format( nid = help_notes('coin_daemon_network_ids'), - xmrw_nid = ', '.join(xmr_wallet_network_ids), - ) + xmrw_nid = ', '.join(xmr_wallet_network_ids)) } } diff --git a/test/include/common.py b/test/include/common.py index 9390b3ea..d7f73cf1 100755 --- a/test/include/common.py +++ b/test/include/common.py @@ -237,8 +237,7 @@ def cmp_or_die(s, t, desc=None): if s != t: die('TestSuiteFatalException', (f'For {desc}:\n' if desc else '') + - f'ERROR: recoded data:\n{t!r}\ndiffers from original data:\n{s!r}' - ) + f'ERROR: recoded data:\n{t!r}\ndiffers from original data:\n{s!r}') def chk_equal(a, b): assert a == b, f'equality test failed: {a} != {b}' @@ -334,8 +333,7 @@ def check_solc_ver(): if cp.returncode == 0: omsg( orange(f'Found supported solc version {res}') if res == tested_solc_ver else - yellow(f'WARNING: solc version ({res}) does not match tested version ({tested_solc_ver})') - ) + yellow(f'WARNING: solc version ({res}) does not match tested version ({tested_solc_ver})')) return True else: omsg(yellow('Warning: Solidity compiler (solc) could not be executed or has unsupported version')) diff --git a/test/include/ecc.py b/test/include/ecc.py index 2f502539..e59cd10e 100755 --- a/test/include/ecc.py +++ b/test/include/ecc.py @@ -35,8 +35,7 @@ def pubkey_tweak_add_pyecdsa(vk_bytes, pk_addend_bytes): pk_addend = int.from_bytes(pk_addend_bytes, byteorder='big') point_sum = ( _pubkey_to_pub_point(vk_bytes) + - ecdsa.SigningKey.from_secret_exponent(pk_addend, curve=ecdsa.SECP256k1).verifying_key.pubkey.point - ) + ecdsa.SigningKey.from_secret_exponent(pk_addend, curve=ecdsa.SECP256k1).verifying_key.pubkey.point) _check_pub_point(point_sum, vk_bytes, pk_addend_bytes) return overlay_fake_pubkey_format( ecdsa.VerifyingKey.from_public_point(point_sum, curve=ecdsa.curves.SECP256k1).to_string(), diff --git a/test/include/unit_test.py b/test/include/unit_test.py index 2ebee806..b9168118 100755 --- a/test/include/unit_test.py +++ b/test/include/unit_test.py @@ -222,8 +222,7 @@ def run_test(test, subtest=None): fast_skip = getattr(t, 'fast_skip', ()) subtests = ( [subtest] if subtest else - [k for k, v in type(t).__dict__.items() if type(v).__name__ == 'function' and k[0] != '_'] - ) + [k for k, v in type(t).__dict__.items() if type(v).__name__ == 'function' and k[0] != '_']) if hasattr(t, '_pre'): t._pre() diff --git a/test/misc/input_func.py b/test/misc/input_func.py index 8274ed08..51ff8797 100755 --- a/test/misc/input_func.py +++ b/test/misc/input_func.py @@ -23,7 +23,7 @@ match cfg._args: from mmgen.ui import get_words_from_user pw = get_words_from_user( cfg, - ('Enter passphrase: ', 'Enter passphrase (echoed): ')[bool(cfg.echo_passphrase)] ) + ('Enter passphrase: ', 'Enter passphrase (echoed): ')[bool(cfg.echo_passphrase)]) msg('Entered: {}'.format(' '.join(pw))) case 'get_char' | 'line_input' as cmd, args: from mmgen.term import get_char diff --git a/test/misc/term.py b/test/misc/term.py index 36f65536..81a0173b 100755 --- a/test/misc/term.py +++ b/test/misc/term.py @@ -119,8 +119,7 @@ def _tt_get_char(raw=False, one_char=False, immed_chars=''): if one_char and not raw else "echoed AS A SINGLE character '\\x1b'." if one_char else - 'echoed as a FULL CONTROL SEQUENCE.' - ) + 'echoed as a FULL CONTROL SEQUENCE.') if gc.platform == 'win32': if raw: m3 = 'The Escape and F1-F12 keys will be returned as two-character strings.' diff --git a/test/modtest_d/addrlist.py b/test/modtest_d/addrlist.py index 65ce0530..5f042791 100755 --- a/test/modtest_d/addrlist.py +++ b/test/modtest_d/addrlist.py @@ -94,8 +94,7 @@ class unit_tests: def addr(self, name, ut): return ( do_test(AddrList, 'BCE8 082C 0973 A525', '1-3') and - do_test(AddrList, '88FA B04B A380 C1CB', '199999,99-101,77-78,7,3,2-9') - ) + do_test(AddrList, '88FA B04B A380 C1CB', '199999,99-101,77-78,7,3,2-9')) def key(self, name, ut): return do_test(KeyList, None) diff --git a/test/modtest_d/baseconv.py b/test/modtest_d/baseconv.py index 1c055137..a025bc94 100755 --- a/test/modtest_d/baseconv.py +++ b/test/modtest_d/baseconv.py @@ -245,8 +245,7 @@ class unit_test: ('pad arg (out)', bpe, "illegal value for 'pad'", lambda: to58('Z', pad='foo')), ('pad arg (out)', bpe, "illegal value for 'pad'", lambda: to58('Z', pad=False)), ('pad arg (out)', bpe, "illegal value for 'pad'", lambda: to58('Z', pad=True)), - ('seedlen (out)', bce, 'invalid length for seed', lambda: to58('Z', pad='seed')), - ) + ('seedlen (out)', bce, 'invalid length for seed', lambda: to58('Z', pad='seed'))) ut.process_bad_data(bad_data) diff --git a/test/modtest_d/bip39.py b/test/modtest_d/bip39.py index 87b53d6c..d900472f 100755 --- a/test/modtest_d/bip39.py +++ b/test/modtest_d/bip39.py @@ -97,9 +97,7 @@ class unit_tests: ), ( "f585c11aec520db57dd353c69554b21a89b20fb0650966fa0a9d6f74fd989d8f", "void come effort suffer camp survey warrior heavy shoot primary clutch crush open amazing screen " - "patrol group space point ten exist slush involve unfold" - ) - ) + "patrol group space point ten exist slush involve unfold")) def conversion(self, name, ut): @@ -154,8 +152,7 @@ class unit_tests: ('pad len (tohex)', 'AssertionError', "invalid 'pad' arg", lambda: th(good_mn, pad=23)), ('word', 'MnemonicError', "not in the BIP39", lambda: th(bad_word_mn)), ('checksum', 'MnemonicError', "checksum", lambda: th(bad_chksum_mn)), - ('seed phrase len', 'MnemonicError', "phrase len", lambda: th(bad_len_mn)), - ) + ('seed phrase len', 'MnemonicError', "phrase len", lambda: th(bad_len_mn))) ut.process_bad_data(bad_data) diff --git a/test/modtest_d/bip_hd.py b/test/modtest_d/bip_hd.py index a271471f..6f86b5a6 100755 --- a/test/modtest_d/bip_hd.py +++ b/test/modtest_d/bip_hd.py @@ -226,10 +226,7 @@ class unit_tests: a = BipHDNode.from_extended_key(cfg, 'btc', chain2.xpub) b = BipHDNode.from_extended_key(cfg, 'btc', chain2.xprv) - vmsg( - '\n xpub:\n' + - fmt(str(Bip32ExtendedKey(b.xpub)), indent=' ') - ) + vmsg('\n xpub:\n' + fmt(str(Bip32ExtendedKey(b.xpub)), indent=' ')) assert a.xpub == b.xpub vmsg(' Addresses:') @@ -389,8 +386,7 @@ class unit_tests: ('depth 3 (account): node not hardened', 'ValueError', 'value for ‘hardened’', bad09), ('depth 4 (chain): idx not set', 'ValueError', 'must be either 0', bad10), ('depth 5 (leaf node): idx not set', 'ValueError', 'must be set', bad11), - ('depth 5 (leaf node): hardened True', 'ValueError', 'must be None', bad12), - ) + ('depth 5 (leaf node): hardened True', 'ValueError', 'must be None', bad12)) ut.process_bad_data(bad_data, pfx='') vmsg('') @@ -416,8 +412,8 @@ class unit_tests: 'private key is zero!', 'private key >= group order!', 'Public key could not be parsed', # extmod - 'incorrect checksum', - ) + 'incorrect checksum') + ut.process_bad_data([(vec[n][1], 'ValueError', exc[n], func[n]) for n in range(len(vec))], pfx='') vmsg('') return True diff --git a/test/modtest_d/ecc.py b/test/modtest_d/ecc.py index bcd0e731..6fa985cb 100755 --- a/test/modtest_d/ecc.py +++ b/test/modtest_d/ecc.py @@ -95,8 +95,7 @@ class unit_tests: ('recover: bad sig len', 'ValueError', 'Invalid signature length', recov4), ('recover: bad msghash len', 'ValueError', 'message hash length', recov5), ('recover: bad pubkey', 'AssertionError', 'bad pubkey', recov6), - ('recover: bad pubkey', 'AssertionError', 'good pubkey', recov7), - ) + ('recover: bad pubkey', 'AssertionError', 'good pubkey', recov7)) ut.process_bad_data(bad_data, pfx='') return True @@ -169,8 +168,7 @@ class unit_tests: ('invalid pubkey (65 bytes)', 'ValueError', 'Invalid first byte', check2), ('invalid pubkey (65 bytes)', 'ValueError', 'Invalid first byte', check3), ('pubkey length == 64', 'ValueError', 'Serialized public key length not', check4), - ('pubkey length == 0', 'ValueError', 'Serialized public key length not', check5), - ) + ('pubkey length == 0', 'ValueError', 'Serialized public key length not', check5)) ut.process_bad_data(bad_data, pfx='') return True diff --git a/test/modtest_d/misc.py b/test/modtest_d/misc.py index bbb50568..82eedadd 100755 --- a/test/modtest_d/misc.py +++ b/test/modtest_d/misc.py @@ -43,8 +43,7 @@ class unit_tests: (0, 7200, False, True, '2 hours'), (0, 3600 + 180 + 1, False, True, '1 hour 3 minutes 1 second'), (0, 3600*27 + 180 + 7, False, True, '1 day 3 hours 3 minutes 7 seconds'), - (0, 3600*24*367 + 180 + 7, True, True, '367 days 3 minutes 7 seconds ago'), - ) + (0, 3600*24*367 + 180 + 7, True, True, '367 days 3 minutes 7 seconds ago')) fs = ' {:7} {:9} {:<8} {}' vmsg(brown(' vectors:')) diff --git a/test/modtest_d/obj.py b/test/modtest_d/obj.py index 2d88b498..96036113 100755 --- a/test/modtest_d/obj.py +++ b/test/modtest_d/obj.py @@ -55,14 +55,12 @@ def coinamt_test(cls, aa, bb, ut): ('floor division', 'NotImplementedError', 'not implemented', lambda: b // a), ('negative result', 'ObjectInitError', 'cannot be negative', lambda: a - b), ('operand type', 'TypeError', 'incorrect type', lambda: a + B), - ('operand type', 'TypeError', 'incorrect type', lambda: b - A), - ) + ('operand type', 'TypeError', 'incorrect type', lambda: b - A)) if cls.max_amt is not None: bad_data += ( ('result', 'ObjectInitError', 'too large', lambda: b + b), - ('result', 'ObjectInitError', 'too large', lambda: b * b), - ) + ('result', 'ObjectInitError', 'too large', lambda: b * b)) ut.process_bad_data(bad_data) diff --git a/test/modtest_d/scrypt.py b/test/modtest_d/scrypt.py index 60751f44..b48282c9 100755 --- a/test/modtest_d/scrypt.py +++ b/test/modtest_d/scrypt.py @@ -34,8 +34,7 @@ class unit_test: pws = ( ('', 'cc8d99ce7365d8a9d2422d71ce330e130b2cade46a8cc0459a3f83e1a6ac3d30'), ('foo', 'f0e2cce1d9980edf2373a2070ad3560c2506faf9bc50704a1bc5cdb3c7f63f3b'), - ('φυβαρ', '64898d01ffcea1252c17411e7bd6c12d00191ee8ddcbf95420e5de8f37a7a1cb') - ) + ('φυβαρ', '64898d01ffcea1252c17411e7bd6c12d00191ee8ddcbf95420e5de8f37a7a1cb')) def test_passwords(): for pw_base, res in pws: diff --git a/test/modtest_d/seedsplit.py b/test/modtest_d/seedsplit.py index bf2d18d9..da4c077f 100755 --- a/test/modtest_d/seedsplit.py +++ b/test/modtest_d/seedsplit.py @@ -22,8 +22,7 @@ def basic_ops(master_idx): 'φυβαρ': ( (8, '4710FBF0', '269D658C', '9D25889E', '6D730ECB', 'C61A963F', '9FE99C05', 0, 0), (6, '9D07ABBD', '4998B33E', 'F00CE041', 'C612BEE5', '35CD3675', '41B3BE61', 0, 0), - (4, '43670520', '77140076', 'EA82CB30', '80F7AEDE', 'D168D768', '77BE57AA', 0, 0), - ) + (4, '43670520', '77140076', 'EA82CB30', '80F7AEDE', 'D168D768', '77BE57AA', 0, 0)) } test_data_master = { '1': { diff --git a/test/modtest_d/util.py b/test/modtest_d/util.py index 93fb7d68..36031de7 100755 --- a/test/modtest_d/util.py +++ b/test/modtest_d/util.py @@ -105,8 +105,7 @@ class unit_tests: ['g', 'h', 0], [None], [0], - [False], - ) + [False]) chk = ['a', 'c', 'd', 'e', None, 1, 'f', None, 0, False] vmsg('=> ' + str(res)) diff --git a/test/modtest_d/xmrseed.py b/test/modtest_d/xmrseed.py index abbedc49..38fe8b99 100755 --- a/test/modtest_d/xmrseed.py +++ b/test/modtest_d/xmrseed.py @@ -50,9 +50,7 @@ class unit_tests: ), ( 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0f', 'foamy solved soggy foamy solved soggy foamy solved soggy foamy solved soggy foamy solved soggy ' + - 'foamy solved soggy foamy solved soggy jury yawning ankle soggy' - ), - ) + 'foamy solved soggy foamy solved soggy jury yawning ankle soggy')) @property def _use_monero_python(self): diff --git a/test/objattrtest.py b/test/objattrtest.py index 0b9d2269..c3ee7101 100755 --- a/test/objattrtest.py +++ b/test/objattrtest.py @@ -72,8 +72,7 @@ def parse_attrbits(bits): bool(0b00010 & bits), # delete bool(0b00100 & bits), # reassign bool(0b01000 & bits), # typeconv - bool(0b10000 & bits), # set_none - ) + bool(0b10000 & bits)) # set_none def get_descriptor_obj(objclass, attrname): for o in (objclass, objclass.__bases__[0]): # assume there's only one base class diff --git a/test/objtest.py b/test/objtest.py index 9fd4eeca..ce607068 100755 --- a/test/objtest.py +++ b/test/objtest.py @@ -102,9 +102,9 @@ def run_test(mod, test, arg, input_data, arg1, exc_name): if cfg.getobj: if args: assert len(args) == 1, 'objtest_chk1: only one positional arg is allowed' - kwargs.update( { arg1: args[0] } ) + kwargs.update({arg1: args[0]}) if cfg.silent: - kwargs.update( { 'silent': True } ) + kwargs.update({'silent': True}) try: if not cfg.super_silent: @@ -172,7 +172,7 @@ def run_test(mod, test, arg, input_data, arg1, exc_name): elif cfg.silent: msg(f'==> {exc_name}') else: - msg( yellow(f' {exc_name}:') + str(e) ) + msg(yellow(f' {exc_name}:') + str(e)) except SystemExit as e: if input_data == 'good': raise ValueError('Error on good input data') from e diff --git a/test/objtest_d/btc_mainnet.py b/test/objtest_d/btc_mainnet.py index 7add6e50..c7747172 100755 --- a/test/objtest_d/btc_mainnet.py +++ b/test/objtest_d/btc_mainnet.py @@ -55,8 +55,7 @@ tests = { {'n': '0x0', 'base': 16, 'ret': 0}, {'n': '0x1', 'base': 16, 'ret': 1}, {'n': '0xf', 'base': 16, 'ret': 15}, - {'n': '0xff', 'base': 16, 'ret': 255}, - ) + {'n': '0xff', 'base': 16, 'ret': 255}) }, 'AddrIdx': { 'arg1': 'n', @@ -90,8 +89,7 @@ tests = { 'good': ( {'fmt_str': '3,2,2', 'ret': (2, 3)}, {'fmt_str': '101,1,3,5,2-7,99', 'ret': (1, 2, 3, 4, 5, 6, 7, 99, 101)}, - {'idx_list': AddrIdxList(fmt_str='1-5'), 'ret': (1, 2, 3, 4, 5)}, - ) + {'idx_list': AddrIdxList(fmt_str='1-5'), 'ret': (1, 2, 3, 4, 5)}) }, 'SubSeedIdxRange': { 'bad': (33, 'x', '-11', '66,3','0', '3-2', '8000000', '100000000', (1, 2, 3)), @@ -100,8 +98,7 @@ tests = { ((3, 5), (3, 5)), ('1-2', (1, 2)), (str(SubSeedList.dfl_len), (SubSeedList.dfl_len, SubSeedList.dfl_len)), - (str(SubSeedIdxRange.max_idx), (SubSeedIdxRange.max_idx, SubSeedIdxRange.max_idx)), - ) + (str(SubSeedIdxRange.max_idx), (SubSeedIdxRange.max_idx, SubSeedIdxRange.max_idx))) }, 'BTCAmt': { 'arg1': 'num', @@ -125,8 +122,7 @@ tests = { { 'num': Decimal('0.00011249') * Decimal('1.0') * 221 / 1024 , # ≈11 sat/byte 'from_decimal': True, 'ret': Decimal('0.00002428')}, - {'num': 1234, 'from_unit': 'satoshi', 'ret': Decimal('0.00001234')}, - ) + {'num': 1234, 'from_unit': 'satoshi', 'ret': Decimal('0.00001234')}) }, 'CoinAddr': { 'arg1': 'addr', @@ -155,8 +151,7 @@ tests = { 'good': ( {'sid': 'F00BAA12'}, {'seed': Seed(cfg, seed_bin=r16), 'ret': SeedID(seed=Seed(cfg, seed_bin=r16))}, - {'sid': Seed(cfg, seed_bin=r16).sid, 'ret': SeedID(seed=Seed(cfg, seed_bin=r16))} - ) + {'sid': Seed(cfg, seed_bin=r16).sid, 'ret': SeedID(seed=Seed(cfg, seed_bin=r16))}) }, 'SubSeedIdx': { 'arg1': 's', @@ -267,8 +262,7 @@ tests = { ), 'good': ( {'proto': proto, 'wif': '5KXEpVzjWreTcQoG5hX357s1969MUKNLuSfcszF6yu84kpsNZKb', 'ret_idx': 1}, - {'proto': proto, 'wif': 'KwWr9rDh8KK5TtDa3HLChEvQXNYcUXpwhRFUPc5uSNnMtqNKLFhk', 'ret_idx': 1}, - ) + {'proto': proto, 'wif': 'KwWr9rDh8KK5TtDa3HLChEvQXNYcUXpwhRFUPc5uSNnMtqNKLFhk', 'ret_idx': 1}) }, 'PubKey': { 'arg1': 's', @@ -277,8 +271,7 @@ tests = { {'s': 'F00BAA12', 'compressed': False}, ), 'good': ( # TODO: add real pubkeys - {'s': bytes.fromhex('deadbeef'), 'compressed': True}, - ) + {'s': bytes.fromhex('deadbeef'), 'compressed': True},) }, 'PrivKey': { 'arg1': 'proto', @@ -300,8 +293,7 @@ tests = { {'proto': proto, 'wif': 'KwWr9rDh8KK5TtDa3HLChEvQXNYcUXpwhRFUPc5uSNnMtqNKLFhk', 'ret': bytes.fromhex('08d0ed83b64b68d56fa064be48e2385060ed205be2b1e63cd56d218038c3a05f')}, {'proto': proto, 's': r32, 'compressed': False, 'pubkey_type': 'std', 'ret': r32}, - {'proto': proto, 's': r32, 'compressed': True, 'pubkey_type': 'std', 'ret': r32} - ) + {'proto': proto, 's': r32, 'compressed': True, 'pubkey_type': 'std', 'ret': r32}) }, 'AddrListID': { 'arg1': 'sid', @@ -312,8 +304,7 @@ tests = { 'good': ( {'id_str': 'F00BAA12:B', 'proto': proto, 'ret': 'F00BAA12:B'}, {'sid': SeedID(sid='F00BAA12'), 'mmtype': proto.addr_type(id_str='S'), 'ret': 'F00BAA12:S'}, - {'sid': SeedID(sid='F00BAA12'), 'mmtype': proto.addr_type(id_str='L'), 'ret': 'F00BAA12:L'}, - ) + {'sid': SeedID(sid='F00BAA12'), 'mmtype': proto.addr_type(id_str='L'), 'ret': 'F00BAA12:L'}) }, 'MMGenWalletLabel': { 'arg1': 's', @@ -360,8 +351,7 @@ tests = { {'proto': proto, 'id_str': 'segwit', 'ret': 'S'}, {'proto': proto, 'id_str': 'S', 'ret': 'S'}, {'proto': proto, 'id_str': 'bech32', 'ret': 'B'}, - {'proto': proto, 'id_str': 'B', 'ret': 'B'} - ) + {'proto': proto, 'id_str': 'B', 'ret': 'B'}) }, 'MMGenPasswordType': { 'arg1': 'proto', @@ -374,15 +364,13 @@ tests = { ), 'good': ( {'proto': proto, 'id_str': 'password', 'ret': 'P'}, - {'proto': proto, 'id_str': 'P', 'ret': 'P'}, - ) + {'proto': proto, 'id_str': 'P', 'ret': 'P'}) }, 'SeedSplitSpecifier': { 'arg1': 's', 'bad': ('M', 'αβ:2', 1, '0:1', '1:1', '2:1', '3:2', '1:2000', 'abc:0:2'), 'good': ( - ('1:2', '2:2', 'alice:2:2', 'αβ:2:2', '1:'+ssm, ssm+':'+ssm) - ) + ('1:2', '2:2', 'alice:2:2', 'αβ:2:2', '1:'+ssm, ssm+':'+ssm)) }, 'IPPort': { 'arg1': 's', @@ -408,8 +396,6 @@ tests = { '10.0.0.1:0', '127.0.0.1:65535', '255.0.0.0:400', - '255.255.255.255:65535', - ) - ) + '255.255.255.255:65535')) }, } diff --git a/test/objtest_d/btc_testnet.py b/test/objtest_d/btc_testnet.py index 27f32cd3..edd27268 100755 --- a/test/objtest_d/btc_testnet.py +++ b/test/objtest_d/btc_testnet.py @@ -44,8 +44,7 @@ tests = { ), 'good': ( {'proto': proto, 'wif': '93HsQEpH75ibaUJYi3QwwiQxnkW4dUuYFPXZxcbcKds7XrqHkY6', 'ret_idx': 1}, - {'proto': proto, 'wif': 'cMsqcmDYZP1LdKgqRh9L4ZRU9br28yvdmTPwW2YQwVSN9aQiMAoR', 'ret_idx': 1}, - ) + {'proto': proto, 'wif': 'cMsqcmDYZP1LdKgqRh9L4ZRU9br28yvdmTPwW2YQwVSN9aQiMAoR', 'ret_idx': 1}) }, 'PrivKey': { 'bad': ( diff --git a/test/objtest_d/eth_mainnet.py b/test/objtest_d/eth_mainnet.py index 432375b4..c4ee6c68 100755 --- a/test/objtest_d/eth_mainnet.py +++ b/test/objtest_d/eth_mainnet.py @@ -42,8 +42,7 @@ tests = { {'num': Decimal('1.234'), 'from_decimal': True, 'ret': Decimal('1.234')}, {'num': Decimal('0.0'), 'from_decimal': True, 'ret': Decimal(0)}, {'num': 1234, 'from_unit': 'wei', 'ret': Decimal('0.000000000000001234')}, - {'num': 1234, 'from_unit': 'Mwei', 'ret': Decimal('0.000000001234')}, - ) + {'num': 1234, 'from_unit': 'Mwei', 'ret': Decimal('0.000000001234')}) }, 'ETHNonce': { 'bad': ('z', 'я', -1, '-1', 0.0, '0.0'), @@ -52,7 +51,6 @@ tests = { {'n': '0x0', 'base': 16, 'ret': 0}, {'n': '0x1', 'base': 16, 'ret': 1}, {'n': '0xf', 'base': 16, 'ret': 15}, - {'n': '0xff', 'base': 16, 'ret': 255}, - ) + {'n': '0xff', 'base': 16, 'ret': 255}) }, } diff --git a/test/objtest_d/ltc_mainnet.py b/test/objtest_d/ltc_mainnet.py index 89963415..eece93ed 100755 --- a/test/objtest_d/ltc_mainnet.py +++ b/test/objtest_d/ltc_mainnet.py @@ -51,8 +51,7 @@ tests = { ), 'good': ( {'proto': proto, 'wif': '6udBAGS6B9RfGyvEQDkVDsWy3Kqv9eTULqtEfVkJtTJyHdLvojw', 'ret_idx': 1}, - {'proto': proto, 'wif': 'T7kCSp5E71jzV2zEJW4q5qU1SMB5CSz8D9VByxMBkamv1uM3Jjca', 'ret_idx': 1}, - ) + {'proto': proto, 'wif': 'T7kCSp5E71jzV2zEJW4q5qU1SMB5CSz8D9VByxMBkamv1uM3Jjca', 'ret_idx': 1}) }, 'PrivKey': { 'bad': ( @@ -73,7 +72,6 @@ tests = { {'proto': proto, 'wif': 'T41Fm7J3mtZLKYPMCLVSFARz4QF8nvSDhLAfW97Ds56Zm9hRJgn8', 'ret': bytes.fromhex('1c6feab55a4c3b4ad1823d4ecacd1565c64228c01828cf44fb4db1e2d82c3d56')}, {'proto': proto, 's': r32, 'compressed': False, 'pubkey_type': 'std', 'ret': r32}, - {'proto': proto, 's': r32, 'compressed': True, 'pubkey_type': 'std', 'ret': r32} - ) + {'proto': proto, 's': r32, 'compressed': True, 'pubkey_type': 'std', 'ret': r32}) }, } diff --git a/test/objtest_d/ltc_testnet.py b/test/objtest_d/ltc_testnet.py index 7be96d80..d8a752f4 100755 --- a/test/objtest_d/ltc_testnet.py +++ b/test/objtest_d/ltc_testnet.py @@ -44,8 +44,7 @@ tests = { ), 'good': ( {'proto': proto, 'wif': '936Fd4qs3Zy2ZiYHH7vZ3UpT23KtCAiGiG2xBTkjHo7jE9aWA2f', 'ret_idx': 1}, - {'proto': proto, 'wif': 'cQY3EumdaSNuttvDSUuPdiMYLyw8aVmYfFqxo9kdPuWbJBN4Ny66', 'ret_idx': 1}, - ) + {'proto': proto, 'wif': 'cQY3EumdaSNuttvDSUuPdiMYLyw8aVmYfFqxo9kdPuWbJBN4Ny66', 'ret_idx': 1}) }, 'PrivKey': { 'bad': ( @@ -66,7 +65,6 @@ tests = { {'proto': proto, 'wif': 'cSaJAXBAm9ooHpVJgoxqjDG3AcareFy29Cz8mhnNTRijjv2HLgta', 'ret': bytes.fromhex('94fa8b90c11fea8fb907c9376b919534b0a75b9a9621edf71a78753544b4101c')}, {'proto': proto, 's': r32, 'compressed': False, 'pubkey_type': 'std', 'ret': r32}, - {'proto': proto, 's': r32, 'compressed': True, 'pubkey_type': 'std', 'ret': r32} - ) + {'proto': proto, 's': r32, 'compressed': True, 'pubkey_type': 'std', 'ret': r32}) }, } diff --git a/test/scrambletest.py b/test/scrambletest.py index 0da91b15..88baeac2 100755 --- a/test/scrambletest.py +++ b/test/scrambletest.py @@ -143,8 +143,7 @@ def make_coin_test_data(): opts = list_gen( [f'--coin={coin}'], [f'--type={mmtype}', mmtype], - ['--cashaddr=0', coin == 'bch'] - ) + ['--cashaddr=0', coin == 'bch']) yield ('mmgen-addrgen', opts, [], [], test_data, 'address') def make_passwd_test_data(): @@ -155,8 +154,7 @@ def make_passwd_test_data(): pw_fmt, pw_len, pw_id = id_str.split('_') opts = list_gen( [f'--passwd-fmt={pw_fmt}', pw_fmt != 'dfl'], - [f'--passwd-len={pw_len}', pw_len != 'dfl'], - ) + [f'--passwd-len={pw_len}', pw_len != 'dfl']) yield ('mmgen-passgen', opts, ['--accept-defaults'], [pw_id], test_data, 'password') def main(): diff --git a/test/tooltest.py b/test/tooltest.py index 0a4cbbb3..29ac20ba 100755 --- a/test/tooltest.py +++ b/test/tooltest.py @@ -208,8 +208,7 @@ if cfg.testing_status: set(ignore) - set(tested_in['tooltest.py']) - set(tested_in['tooltest2.py']) - - set(tested_in['cmdtest.py']) - ) + set(tested_in['cmdtest.py'])) if uc: Msg(yellow('\n {}\n {}'.format('Untested commands:', '\n '.join(uc)))) sys.exit(0) @@ -254,8 +253,7 @@ class MMGenToolTestUtils: add_opts + [name.lower()] + tool_args + - kwargs.split() - ) + kwargs.split()) if extra_msg: extra_msg = f'({extra_msg})' full_name = ' '.join([name.lower()]+add_opts+kwargs.split()+extra_msg.split()) diff --git a/test/tooltest2.py b/test/tooltest2.py index c952d82c..045a56bb 100755 --- a/test/tooltest2.py +++ b/test/tooltest2.py @@ -86,8 +86,7 @@ def fork_cmd(cmd_name, args, opts, stdin_input): tool_cmd_preargs + tool_cmd + (opts or []) + - [cmd_name] + args - ) + [cmd_name] + args) vmsg('{} {}'.format( green('Executing'), cyan(' '.join(cmd))))