diff --git a/mmgen/addrlist.py b/mmgen/addrlist.py index 1a43ec3e..4c0536a6 100755 --- a/mmgen/addrlist.py +++ b/mmgen/addrlist.py @@ -186,7 +186,9 @@ class AddrList(MMGenObject): # Address info for a single seed ID if seed and addr_idxs: # data from seed + idxs self.al_id = AddrListID(sid=seed.sid, mmtype=MMGenAddrType(proto, mmtype or proto.dfl_mmtype)) src = 'gen' - adata = self.generate(seed, addr_idxs if isinstance(addr_idxs, AddrIdxList) else AddrIdxList(addr_idxs)) + adata = self.generate( + seed, + addr_idxs if isinstance(addr_idxs, AddrIdxList) else AddrIdxList(addr_idxs)) do_chksum = True elif infile: # data from MMGen address file self.infile = infile diff --git a/mmgen/bip_hd/__init__.py b/mmgen/bip_hd/__init__.py index a76222ea..9765cda5 100644 --- a/mmgen/bip_hd/__init__.py +++ b/mmgen/bip_hd/__init__.py @@ -193,7 +193,13 @@ class MasterNode(Lockable): new = BipHDNodeMaster() - new.cfg = BipHDConfig(self.base_cfg, coin, network, addr_type, from_path, no_path_checks) + new.cfg = BipHDConfig( + self.base_cfg, + coin, + network, + addr_type, + from_path, + no_path_checks) new.par_print = self.par_print new.depth = self.depth new.key = self.key diff --git a/mmgen/led.py b/mmgen/led.py index 75a127de..9e1c7716 100755 --- a/mmgen/led.py +++ b/mmgen/led.py @@ -33,7 +33,13 @@ class LEDControl: class binfo(Lockable): _reset_ok = ('trigger_reset',) - def __init__(self, name, control, trigger=None, trigger_dfl='heartbeat', trigger_disable='none'): + def __init__( + self, + name, + control, + trigger = None, + trigger_dfl = 'heartbeat', + trigger_disable = 'none'): self.name = name self.control = control self.trigger = trigger diff --git a/mmgen/passwdlist.py b/mmgen/passwdlist.py index 793e3b93..763e8005 100755 --- a/mmgen/passwdlist.py +++ b/mmgen/passwdlist.py @@ -126,22 +126,18 @@ class PasswordList(AddrList): die('InvalidPasswdFormat', f'{self.pw_fmt!r}: invalid password format. Valid formats: {", ".join(self.pw_info)}') - def chk_pw_len(self, passwd=None): - if passwd is None: - assert self.pw_len, 'either passwd or pw_len must be set' - pw_len = self.pw_len - fs = '{l}: invalid user-requested length for {b} ({c}{m})' - else: - pw_len = len(passwd) - fs = '{pw}: {b} has invalid length {l} ({c}{m} characters)' + def chk_pw_len(self): + assert self.pw_len, 'pw_len must be set' + pw_len = self.pw_len + fs = '{l}: invalid user-requested length for {b} ({c}{m})' d = self.pw_info[self.pw_fmt] if d.valid_lens: if pw_len not in d.valid_lens: - die(2, fs.format(l=pw_len, b=d.desc, c='not one of ', m=d.valid_lens, pw=passwd)) + die(2, fs.format(l=pw_len, b=d.desc, c='not one of ', m=d.valid_lens)) elif pw_len > d.max_len: - die(2, fs.format(l=pw_len, b=d.desc, c='>', m=d.max_len, pw=passwd)) + die(2, fs.format(l=pw_len, b=d.desc, c='>', m=d.max_len)) elif pw_len < d.min_len: - die(2, fs.format(l=pw_len, b=d.desc, c='<', m=d.min_len, pw=passwd)) + die(2, fs.format(l=pw_len, b=d.desc, c='<', m=d.min_len)) def set_pw_len(self, pw_len): d = self.pw_info[self.pw_fmt] diff --git a/mmgen/proto/btc/params.py b/mmgen/proto/btc/params.py index 815d0e12..bcbb4f7a 100755 --- a/mmgen/proto/btc/params.py +++ b/mmgen/proto/btc/params.py @@ -65,7 +65,7 @@ class mainnet(CoinProtocol.Secp256k1): # chainparams.cpp 'cashaddr', ) - def encode_wif(self, privbytes, pubkey_type, compressed): # input is preprocessed hex + def encode_wif(self, privbytes, pubkey_type, compressed): # input is preprocessed assert len(privbytes) == self.privkey_len, f'{len(privbytes)} bytes: incorrect private key length!' assert pubkey_type in self.wif_ver_bytes, f'{pubkey_type!r}: invalid pubkey_type' return b58chk_encode( diff --git a/mmgen/proto/btc/tx/completed.py b/mmgen/proto/btc/tx/completed.py index 0d3d3587..5a09a82c 100755 --- a/mmgen/proto/btc/tx/completed.py +++ b/mmgen/proto/btc/tx/completed.py @@ -75,10 +75,6 @@ class Completed(Base, TxBase.Completed): 'scriptPubKey:', i.scriptPubKey, 'scriptPubKey->address:', ds.addr)) -# def is_replaceable_from_rpc(self): -# dec_tx = await self.rpc.call('decoderawtransaction', self.serialized) -# return None < dec_tx['vin'][0]['sequence'] <= self.proto.max_int - 2 - def is_replaceable(self): return self.inputs[0].sequence == self.proto.max_int - 2 diff --git a/mmgen/proto/btc/tx/new.py b/mmgen/proto/btc/tx/new.py index 4594c61c..4618c66b 100755 --- a/mmgen/proto/btc/tx/new.py +++ b/mmgen/proto/btc/tx/new.py @@ -125,7 +125,10 @@ class New(Base, TxNew): def final_inputs_ok_msg(self, funds_left): return 'Transaction produces {} {} in change'.format(funds_left.hl(), self.coin) - def check_chg_addr_is_wallet_addr(self, output=None, message='Change address is not an MMGen wallet address!'): + def check_chg_addr_is_wallet_addr( + self, + output = None, + message = 'Change address is not an MMGen wallet address!'): def do_err(): from ....ui import confirm_or_raise confirm_or_raise( diff --git a/mmgen/proto/eth/rpc.py b/mmgen/proto/eth/rpc.py index be55291f..96eb869c 100755 --- a/mmgen/proto/eth/rpc.py +++ b/mmgen/proto/eth/rpc.py @@ -82,7 +82,8 @@ class EthereumRPCClient(RPCClient, metaclass=AsyncInit): if self.daemon.id in ('parity', 'openethereum'): if (await self.call('parity_nodeKind'))['capability'] == 'full': self.caps += ('full_node',) - self.chainID = None if ci is None else Int(ci, 16) # parity/oe return chainID only for dev chain + # parity/openethereum return chainID only for dev chain: + self.chainID = None if ci is None else Int(ci, 16) self.chain = (await self.call('parity_chain')).replace(' ', '_').replace('_testnet', '') elif self.daemon.id in ('geth', 'reth', 'erigon'): if self.daemon.network == 'mainnet': diff --git a/test/test-release.d/cfg.sh b/test/test-release.d/cfg.sh index fdc56435..0af8a16e 100755 --- a/test/test-release.d/cfg.sh +++ b/test/test-release.d/cfg.sh @@ -72,7 +72,8 @@ init_tests() { " [ "$VERBOSE" ] || STDOUT_DEVNULL='> /dev/null' - d_lint="code errors with static code analyzer" + d_lint="code errors with Ruff static code analyzer" + e_lint="Error checking failed!" t_lint=" b ruff check setup.py $STDOUT_DEVNULL b ruff check mmgen $STDOUT_DEVNULL @@ -81,7 +82,7 @@ init_tests() { " PYLINT_OPTS='--errors-only --jobs=0' - d_pylint="code errors with static code analyzer" + d_pylint="code errors with Pylint static code analyzer" e_pylint="Error checking failed!" t_pylint=" b $pylint $PYLINT_OPTS mmgen