ruff PLR1704 (redefining argument with local name)

This commit is contained in:
The MMGen Project 2026-08-07 09:37:47 +00:00
commit 6efa26143f
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 10 additions and 11 deletions

View file

@ -47,10 +47,10 @@ class BitcoinTwTransaction:
def gen_prevouts_data():
_d = namedtuple('prevout_data', ['txid', 'data'])
for tx in prevout_txs:
for ptx in prevout_txs:
for e in prevouts:
if e.txid == tx['txid']:
yield _d(e.txid, tx['vout'][e.vout])
if e.txid == ptx['txid']:
yield _d(e.txid, ptx['vout'][e.vout])
def gen_wallet_vouts_data():
_d = namedtuple('wallet_vout_data', ['txid', 'data'])

View file

@ -422,8 +422,8 @@ class TwAddresses(TwView):
res = get_addr(mmtype)
else:
have_used = False
for mmtype in self.proto.preferred_mmtypes:
res = get_addr(mmtype)
for mmpref in self.proto.preferred_mmtypes:
res = get_addr(mmpref)
if any(res):
break
if False in res:

View file

@ -31,8 +31,8 @@ class OpRestore(OpCreate):
def get_dump_data():
def gen():
for fn in [self.get_wallet_fn(d, watch_only=wo) for wo in (True, False)]:
ret = fn.parent / (fn.name + '.dump')
for f in [self.get_wallet_fn(d, watch_only=wo) for wo in (True, False)]:
ret = f.parent / (f.name + '.dump')
if ret.exists():
yield ret

View file

@ -27,7 +27,6 @@ ignore = [
"N999", # Invalid module name: 'import'
"PLC0206", # Extracting value from dictionary without calling `.items()`
"PLC3002", # Lambda expression called directly. Execute the expression inline instead.
"PLR1704", # Redefining argument with the local name `tx`
"PLW0406", # Module `test.include.common` imports itself
"PLW0602", # Using global for `stderr_save` but no assignment is done
"PLW0602", # Using global for `stdout_save` but no assignment is done

View file

@ -63,15 +63,15 @@ class unit_tests:
return True
def asset(self, name, ut, desc='SwapAsset class'):
for name, full_name, memo_name, chain, tokensym, direction in (
for asset_name, full_name, memo_name, chain, tokensym, direction in (
('BTC', 'BTC.BTC', 'b', 'BTC', None, 'recv'),
('LTC', 'LTC.LTC', 'l', 'LTC', None, 'recv'),
('BCH', 'BCH.BCH', 'c', 'BCH', None, 'recv'),
('ETH.USDT', 'ETH.USDT', 'ETH.USDT', 'ETH', 'USDT', 'recv'),
):
a = SwapAsset(name, direction)
a = SwapAsset(asset_name, direction)
vmsg(f' {a.name}')
assert a.name == name
assert a.name == asset_name
assert a.full_name == full_name
assert a.direction == direction
assert a.tokensym == tokensym