From 6efa26143fb33c021040ad3287be4e8b6e64a65d Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 7 Aug 2026 09:37:47 +0000 Subject: [PATCH] ruff PLR1704 (redefining argument with local name) --- mmgen/proto/btc/tw/txhistory.py | 6 +++--- mmgen/tw/addresses.py | 4 ++-- mmgen/xmrwallet/ops/restore.py | 4 ++-- pyproject.toml | 1 - test/modtest_d/swap.py | 6 +++--- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/mmgen/proto/btc/tw/txhistory.py b/mmgen/proto/btc/tw/txhistory.py index 680ba338..9693ddcf 100755 --- a/mmgen/proto/btc/tw/txhistory.py +++ b/mmgen/proto/btc/tw/txhistory.py @@ -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']) diff --git a/mmgen/tw/addresses.py b/mmgen/tw/addresses.py index 07f6b41f..1773cd9c 100755 --- a/mmgen/tw/addresses.py +++ b/mmgen/tw/addresses.py @@ -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: diff --git a/mmgen/xmrwallet/ops/restore.py b/mmgen/xmrwallet/ops/restore.py index 0805f4f3..46784c68 100755 --- a/mmgen/xmrwallet/ops/restore.py +++ b/mmgen/xmrwallet/ops/restore.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index a0cbed7e..530f8be5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/test/modtest_d/swap.py b/test/modtest_d/swap.py index a29c70a6..f74a8a28 100755 --- a/test/modtest_d/swap.py +++ b/test/modtest_d/swap.py @@ -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