ruff PLC0206 (extracting value from dictionary without calling .items())

This commit is contained in:
The MMGen Project 2026-08-10 09:54:34 +00:00
commit 5bdf32ce41
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 12 additions and 13 deletions

View file

@ -98,12 +98,12 @@ class TwAddrData(AddrData, metaclass=AsyncInit):
self.cfg._util.vmsg(f'{i} {gc.proj_name} addresses found, {len(twd)} accounts total')
for al_id in out:
for al_id, data in out.items():
self.add(AddrList(
self.cfg,
self.proto,
al_id = al_id,
adata = AddrListData(sorted(out[al_id], key=lambda a: a.idx))))
adata = AddrListData(sorted(data, key=lambda a: a.idx))))
class TwAddrDataWithStore(TwAddrData):

View file

@ -150,9 +150,9 @@ class coin_msg:
'sig': 'signature:'}
def gen_entry(e):
for k in labels:
for k, v in labels.items():
if e.get(k):
yield fs_sig.format(labels[k], e[k])
yield fs_sig.format(v, e[k])
def gen_all():
for k, v in hdr_data.items():

View file

@ -24,7 +24,6 @@ ignore = [
"I001", # Import block is un-sorted or un-formatted
"ISC004", # Unparenthesized implicit string concatenation in collection
"N999", # Invalid module name: 'import'...
"PLC0206", # Extracting value from dictionary without calling `.items()`
"PLW1510", # `subprocess.run` without explicit `check` argument
"RET501", # Do not explicitly `return None` in function if it is the only possible return value
"RUF012", # Mutable default value for class attribute

View file

@ -267,8 +267,8 @@ cfgs = { # addr_idx_lists (except 31, 32, 33, 34) must contain exactly 8 address
def fixup_cfgs():
import os
for k in cfgs:
cfgs[k]['tmpdir'] = os.path.join('test', 'tmp', str(k))
for k, v in cfgs.items():
v['tmpdir'] = os.path.join('test', 'tmp', str(k))
for src, target in (
('6', '11'),
@ -280,11 +280,11 @@ def fixup_cfgs():
cfgs[target].update(cfgs[src])
cfgs[target]['tmpdir'] = os.path.join('test', 'tmp', target)
for k in cfgs:
cfgs[k]['segwit'] = randbool() if cfg.segwit_random else bool(cfg.segwit or cfg.bech32)
for k, v in cfgs.items():
v['segwit'] = randbool() if cfg.segwit_random else bool(cfg.segwit or cfg.bech32)
if cfg.debug_utf8:
for k in cfgs:
cfgs[k]['tmpdir'] += ''
for k, v in cfgs.items():
v['tmpdir'] += ''
fixup_cfgs()

View file

@ -495,8 +495,8 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
self.proto = init_proto(cfg, coin, network='regtest', need_amt=True)
gldict = globals()
for k in rt_data:
gldict[k] = rt_data[k].get(coin, None)
for k, v in rt_data.items():
gldict[k] = v.get(coin, None)
self.use_bdb_wallet = self.bdb_wallet or coin != 'btc'