From 62cd757eba26b81e08888fba5762f9f730d2ff70 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 7 Aug 2025 12:50:25 -0700 Subject: [PATCH] Enable Ruff `PLR1704` (`redefined-argument-from-local`) --- chia/cmds/wallet_funcs.py | 6 +++--- chia/data_layer/data_store.py | 12 ++++++------ chia/wallet/nft_wallet/nft_wallet.py | 6 +++--- ruff.toml | 1 - 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/chia/cmds/wallet_funcs.py b/chia/cmds/wallet_funcs.py index f0b712a63080..6f0051e02054 100644 --- a/chia/cmds/wallet_funcs.py +++ b/chia/cmds/wallet_funcs.py @@ -179,7 +179,7 @@ async def get_unit_name_for_wallet_id( async def get_transaction( *, root_path: pathlib.Path, wallet_rpc_port: Optional[int], fingerprint: Optional[int], tx_id: str, verbose: int ) -> None: - async with get_wallet_client(root_path, wallet_rpc_port, fingerprint) as (wallet_client, fingerprint, config): + async with get_wallet_client(root_path, wallet_rpc_port, fingerprint) as (wallet_client, _, config): transaction_id = bytes32.from_hexstr(tx_id) address_prefix = selected_network_address_prefix(config) tx: TransactionRecord = await wallet_client.get_transaction(transaction_id=transaction_id) @@ -1865,7 +1865,7 @@ async def approve_r_cats( push: bool, condition_valid_times: ConditionValidTimes, ) -> list[TransactionRecord]: - async with get_wallet_client(root_path, wallet_rpc_port, fingerprint) as (wallet_client, fingerprint, config): + async with get_wallet_client(root_path, wallet_rpc_port, fingerprint) as (wallet_client, fp, config): if wallet_client is None: return txs = await wallet_client.crcat_approve_pending( @@ -1876,7 +1876,7 @@ async def approve_r_cats( min_coin_amount=min_coin_amount, max_coin_amount=max_coin_amount, reuse_puzhash=reuse, - ).to_tx_config(units["cat"], config, fingerprint), + ).to_tx_config(units["cat"], config, fp), push=push, timelock_info=condition_valid_times, ) diff --git a/chia/data_layer/data_store.py b/chia/data_layer/data_store.py index 039b68973693..320312c4eb10 100644 --- a/chia/data_layer/data_store.py +++ b/chia/data_layer/data_store.py @@ -1172,8 +1172,8 @@ async def update_ancestor_hashes_on_insert( ) if status == Status.COMMITTED: - for left_hash, right_hash, store_id in insert_ancestors_cache: - await self._insert_ancestor_table(left_hash, right_hash, store_id, new_generation) + for left_hash, right_hash, cache_store_id in insert_ancestors_cache: + await self._insert_ancestor_table(left_hash, right_hash, cache_store_id, new_generation) return new_root @@ -1329,8 +1329,8 @@ async def delete( generation=new_generation, ) if status == Status.COMMITTED: - for left_hash, right_hash, store_id in insert_ancestors_cache: - await self._insert_ancestor_table(left_hash, right_hash, store_id, new_generation) + for left_hash, right_hash, cache_store_id in insert_ancestors_cache: + await self._insert_ancestor_table(left_hash, right_hash, cache_store_id, new_generation) return new_root @@ -1428,8 +1428,8 @@ async def clean_node_table(self, writer: Optional[aiosqlite.Connection] = None) """ params = {"pending_status": Status.PENDING.value, "pending_batch_status": Status.PENDING_BATCH.value} if writer is None: - async with self.db_wrapper.writer(foreign_key_enforcement_enabled=False) as writer: - await writer.execute(query, params) + async with self.db_wrapper.writer(foreign_key_enforcement_enabled=False) as sub_writer: + await sub_writer.execute(query, params) else: await writer.execute(query, params) diff --git a/chia/wallet/nft_wallet/nft_wallet.py b/chia/wallet/nft_wallet/nft_wallet.py index 81a2e8017fd0..631d4c6cacb2 100644 --- a/chia/wallet/nft_wallet/nft_wallet.py +++ b/chia/wallet/nft_wallet/nft_wallet.py @@ -550,9 +550,9 @@ async def create_from_puzzle_info( name: Optional[str] = None, ) -> Any: # Off the bat we don't support multiple profile but when we do this will have to change - for wallet in wallet_state_manager.wallets.values(): - if wallet.type() == WalletType.NFT.value: - return wallet + for wsm_wallet in wallet_state_manager.wallets.values(): + if wsm_wallet.type() == WalletType.NFT.value: + return wsm_wallet # TODO: These are not the arguments to this function yet but they will be return await cls.create_new_nft_wallet( diff --git a/ruff.toml b/ruff.toml index d05f462a1bd4..fa1163ab8375 100644 --- a/ruff.toml +++ b/ruff.toml @@ -61,7 +61,6 @@ ignore = [ # Should probably fix these "PLR6301", # no-self-use "PLR2004", # magic-value-comparison - "PLR1704", # redefined-argument-from-local "PLR5501", # collapsible-else-if # Pylint warning