whitespace (hanging parentheses)
This commit is contained in:
parent
ff35b01c45
commit
d87e67406a
22 changed files with 28 additions and 52 deletions
|
|
@ -125,8 +125,7 @@ class LEDControl:
|
|||
msg('\n{}\n{}\n{}'.format(
|
||||
blue(f'You do not have write access to the {desc}'),
|
||||
blue(f'To allow access, run the following command:\n\n {cmd}'),
|
||||
orange('[To prevent this message in the future, enable sudo without a password]')
|
||||
))
|
||||
orange('[To prevent this message in the future, enable sudo without a password]')))
|
||||
sys.exit(1)
|
||||
|
||||
def init_state(fn, *, desc, init_val=None):
|
||||
|
|
|
|||
|
|
@ -303,8 +303,7 @@ class MnemonicEntry:
|
|||
msg(' {}) {:8} {}'.format(
|
||||
n,
|
||||
mode.name + ':',
|
||||
fmt(mode.choose_info, indent=' '*14).lstrip().format(usl=self.uniq_ss_len),
|
||||
))
|
||||
fmt(mode.choose_info, indent=' '*14).lstrip().format(usl=self.uniq_ss_len)))
|
||||
prompt = f'Type a number, or hit ENTER for the default ({capfirst(self.dfl_entry_mode)}): '
|
||||
erase = '\r' + ' ' * (len(prompt)+19) + '\r'
|
||||
while True:
|
||||
|
|
@ -343,8 +342,7 @@ class MnemonicEntry:
|
|||
ml = mn_len,
|
||||
ssl = em.ss_len,
|
||||
pad_max = em.pad_max,
|
||||
sw = self.shortest_word,
|
||||
))
|
||||
sw = self.shortest_word))
|
||||
|
||||
clear_line = '\n' if self.cfg.test_suite else '{r}{s}{r}'.format(r='\r', s=' '*40)
|
||||
idx, idxs = 1, [] # initialize idx to a non-None value
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@ class coin_msg:
|
|||
json.dumps(
|
||||
{k: self.data[k] for k in self.chksum_keys},
|
||||
sort_keys = True,
|
||||
separators = (',', ':')
|
||||
))
|
||||
separators = (',', ':')))
|
||||
|
||||
@property
|
||||
def filename_stem(self):
|
||||
|
|
|
|||
|
|
@ -391,7 +391,6 @@ class UserOpts(Opts):
|
|||
cmd = (
|
||||
['-']
|
||||
+ (['r'] if caps.rpc else [])
|
||||
+ (['p', 'c'] if caps.proto and caps.use_coin_opt else ['p'] if caps.proto else [])
|
||||
))
|
||||
+ (['p', 'c'] if caps.proto and caps.use_coin_opt else ['p'] if caps.proto else [])))
|
||||
else: # unmanaged command: enable everything
|
||||
return ret(None, None)
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@ class BitcoinTwTransaction:
|
|||
(d.twlabel.twmmid.sort_key if d.twlabel and d.twlabel.twmmid.type == 'mmgen' else '')
|
||||
+ '_'
|
||||
+ d.txid
|
||||
+ '{:08d}'.format(d.data['n'])
|
||||
))
|
||||
+ '{:08d}'.format(d.data['n'])))
|
||||
|
||||
def gen_all_addrs(src):
|
||||
for e in self.vouts_info[src]:
|
||||
|
|
|
|||
|
|
@ -53,10 +53,9 @@ class EthereumRPCClient(RPCClient, metaclass=AsyncInit):
|
|||
await self.set_backend_async(backend)
|
||||
|
||||
vi, bh, ci = await self.gathered_call(None, (
|
||||
('web3_clientVersion', ()),
|
||||
('eth_getBlockByNumber', ('latest', False)),
|
||||
('eth_chainId', ()),
|
||||
))
|
||||
('web3_clientVersion', ()),
|
||||
('eth_getBlockByNumber', ('latest', False)),
|
||||
('eth_chainId', ())))
|
||||
|
||||
vip = re.match(self.daemon.version_pat, vi, re.ASCII)
|
||||
if not vip:
|
||||
|
|
|
|||
|
|
@ -99,8 +99,7 @@ class SubSeedList(MMGenObject):
|
|||
msg_r('{} {} of {}...'.format(
|
||||
green('Generating subseed'),
|
||||
ss_idx.hl(),
|
||||
self.parent_seed.sid.hl(),
|
||||
))
|
||||
self.parent_seed.sid.hl()))
|
||||
|
||||
if ss_idx.idx > len(self):
|
||||
self._generate(ss_idx.idx)
|
||||
|
|
@ -134,8 +133,7 @@ class SubSeedList(MMGenObject):
|
|||
green('Found subseed'),
|
||||
subseed.sid.hl(),
|
||||
self.parent_seed.sid.hl(),
|
||||
subseed.ss_idx.hl(),
|
||||
))
|
||||
subseed.ss_idx.hl()))
|
||||
|
||||
if last_idx is None:
|
||||
last_idx = self.len
|
||||
|
|
|
|||
|
|
@ -92,8 +92,7 @@ class tool_api(
|
|||
from ..altcoin.params import CoinInfo
|
||||
return sorted(set(
|
||||
[c.upper() for c in CoinProtocol.coins]
|
||||
+ [c.symbol for c in CoinInfo.get_supported_coins(self.proto.network)]
|
||||
))
|
||||
+ [c.symbol for c in CoinInfo.get_supported_coins(self.proto.network)]))
|
||||
|
||||
@property
|
||||
def coin(self):
|
||||
|
|
|
|||
|
|
@ -142,8 +142,7 @@ class tool_cmd(tool_cmd_base):
|
|||
pubkey = bytes.fromhex(pubkeyhex),
|
||||
viewkey_bytes = None,
|
||||
pubkey_type = self.mmtype.pubkey_type,
|
||||
compressed = self.mmtype.compressed,
|
||||
))
|
||||
compressed = self.mmtype.compressed))
|
||||
|
||||
def pubhex2redeem_script(self, pubkeyhex: fstr): # new
|
||||
"convert a hexadecimal pubkey to a Segwit P2SH-P2WPKH redeem script"
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ def write_mode(orig_func):
|
|||
if self.mode != 'w':
|
||||
die(1, '{} opened in read-only mode: cannot execute method {}()'.format(
|
||||
type(self).__name__,
|
||||
locals()['orig_func'].__name__
|
||||
))
|
||||
locals()['orig_func'].__name__))
|
||||
return orig_func(self, *args, **kwargs)
|
||||
return f
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,7 @@ class wallet(MMGenObject, metaclass=WalletMeta):
|
|||
b = self.seed.sid.hl(),
|
||||
c = f' (seed length {self.seed.bitlen})' if self.seed.bitlen != 256 else '',
|
||||
d = '' if not hasattr(self, 'mnemonic') or self.mnemonic.has_chksum else
|
||||
orange(' [mnemonic format has no checksum]')
|
||||
))
|
||||
orange(' [mnemonic format has no checksum]')))
|
||||
|
||||
def _get_data(self):
|
||||
if hasattr(self, 'infile'):
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ class wallet(wallet):
|
|||
def _print_seed_type(self):
|
||||
msg('{} {}'.format(
|
||||
blue(f'{capfirst(self.base_type or self.type)} type:'),
|
||||
yellow(self.mn_type)
|
||||
))
|
||||
yellow(self.mn_type)))
|
||||
|
||||
def _choose_seedlen(self, ok_lens):
|
||||
|
||||
|
|
|
|||
|
|
@ -86,8 +86,7 @@ class OpSync(OpWallet):
|
|||
from . import hl_amt
|
||||
msg(' Balance: {} Unlocked balance: {}'.format(
|
||||
hl_amt(wd.accts_data['total_balance']),
|
||||
hl_amt(wd.accts_data['total_unlocked_balance']),
|
||||
))
|
||||
hl_amt(wd.accts_data['total_unlocked_balance'])))
|
||||
|
||||
self.wallets_data[fn.name] = wd
|
||||
|
||||
|
|
|
|||
|
|
@ -233,8 +233,7 @@ class CmdTestRunner:
|
|||
t = int(time.time() - self.start_time)
|
||||
sys.stderr.write(green(
|
||||
f'{self.cmd_total} test{suf(self.cmd_total)} performed' +
|
||||
('\n' if self.cfg.no_timings else f'. Elapsed time: {t//60:02d}:{t%60:02d}\n')
|
||||
))
|
||||
('\n' if self.cfg.no_timings else f'. Elapsed time: {t//60:02d}:{t%60:02d}\n')))
|
||||
|
||||
def init_group(self, gname, sg_name=None, cmd=None, quiet=False, do_clean=True):
|
||||
|
||||
|
|
|
|||
|
|
@ -864,8 +864,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared):
|
|||
wcls = get_wallet_cls(fmt_code=out_fmt)
|
||||
msg('==> {}: {}'.format(
|
||||
wcls.desc,
|
||||
cyan(get_data_from_file(self.cfg, f, desc=wcls.desc))
|
||||
))
|
||||
cyan(get_data_from_file(self.cfg, f, desc=wcls.desc))))
|
||||
end_silence()
|
||||
return t
|
||||
|
||||
|
|
|
|||
|
|
@ -289,8 +289,7 @@ def oqmsg_r(s):
|
|||
def end_msg(t):
|
||||
omsg(green(
|
||||
'All requested tests finished OK' +
|
||||
('' if cfg.test_suite_deterministic else f', elapsed time: {t//60:02d}:{t%60:02d}')
|
||||
))
|
||||
('' if cfg.test_suite_deterministic else f', elapsed time: {t//60:02d}:{t%60:02d}')))
|
||||
|
||||
def start_test_daemons(*network_ids, remove_datadir=False, verbose=False):
|
||||
if not cfg.no_daemon_autostart:
|
||||
|
|
|
|||
|
|
@ -129,8 +129,7 @@ class UnitTestHelpers:
|
|||
|
||||
def skip_msg(self, desc):
|
||||
cfg._util.qmsg(gray(
|
||||
f'Skipping {test_type} subtest {self.subtest_name.replace("_", "-")!r} for {desc}'
|
||||
))
|
||||
f'Skipping {test_type} subtest {self.subtest_name.replace("_", "-")!r} for {desc}'))
|
||||
|
||||
def process_bad_data(self, data, pfx='bad '):
|
||||
if os.getenv('PYTHONOPTIMIZE'):
|
||||
|
|
@ -226,8 +225,7 @@ def run_test(test, subtest=None):
|
|||
|
||||
def subtest_skip_msg(name, add_msg):
|
||||
cfg._util.qmsg(gray(
|
||||
'Skipping {} subtest {!r} {}'.format(test_type, name.replace('_', '-'), add_msg)
|
||||
))
|
||||
'Skipping {} subtest {!r} {}'.format(test_type, name.replace('_', '-'), add_msg)))
|
||||
|
||||
for _subtest in subtests:
|
||||
if cfg.no_altcoin_deps and _subtest in altcoin_deps:
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ match op:
|
|||
cfg._proto.coin.lower(),
|
||||
type(cfg._proto).__name__,
|
||||
varname,
|
||||
getattr(cfg._proto, varname)
|
||||
))
|
||||
getattr(cfg._proto, varname)))
|
||||
case 'autoset_opts':
|
||||
assert cfg.rpc_backend == 'aiohttp', "cfg.rpc_backend != 'aiohttp'"
|
||||
case 'autoset_opts_cmdline':
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ match cfg._args:
|
|||
func_args.update({'cfg':cfg})
|
||||
msg(' Calling {name}({args})'.format(
|
||||
name = cmd,
|
||||
args = ', '.join(f'{k}={v!r}' for k, v in func_args.items())
|
||||
))
|
||||
args = ', '.join(f'{k}={v!r}' for k, v in func_args.items())))
|
||||
ret = locals()[cmd](**func_args)
|
||||
msg(f' ==> {ret!r}')
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ def _tt_get_char(raw=False, one_char=False, immed_chars=''):
|
|||
|
||||
cmsg('Testing {}({}):'.format(
|
||||
funcname,
|
||||
','.join(f'{a}={b!r}' for a, b in kwargs.items())
|
||||
))
|
||||
','.join(f'{a}={b!r}' for a, b in kwargs.items())))
|
||||
|
||||
msg(fs.format(m1, yellow(m2), yellow(m3)))
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ if overlay_fake_os.getenv('MMGEN_TEST_SUITE_BOGUS_UNSPENT_DATA'):
|
|||
from ....fileutil import get_data_from_file
|
||||
return json.loads(get_data_from_file(
|
||||
self.cfg,
|
||||
overlay_fake_os.getenv('MMGEN_TEST_SUITE_BOGUS_UNSPENT_DATA')
|
||||
))
|
||||
overlay_fake_os.getenv('MMGEN_TEST_SUITE_BOGUS_UNSPENT_DATA')))
|
||||
|
||||
BitcoinTwUnspentOutputs.get_rpc_data = overlay_fake_BitcoinTwUnspentOutputs.get_rpc_data
|
||||
|
|
|
|||
|
|
@ -273,8 +273,7 @@ def do_group(gid):
|
|||
cls = main_tool.get_mod_cls(gid.lower())
|
||||
qmsg(blue('Testing ' +
|
||||
desc if cfg.names else
|
||||
(docstring_head(cls) or desc)
|
||||
))
|
||||
(docstring_head(cls) or desc)))
|
||||
|
||||
for cmdname in cls(cfg).user_commands:
|
||||
if cmdname in skipped_tests:
|
||||
|
|
|
|||
Loading…
Reference in a new issue