From 339a617ee1bb7af573861e394101cbcfa094f36a Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 31 Oct 2024 10:40:39 -0700 Subject: [PATCH] Manually fix tuples with `as` --- chia/_tests/blockchain/test_blockchain.py | 4 +-- chia/_tests/conftest.py | 2 +- .../full_node/stores/test_full_node_store.py | 4 +-- chia/_tests/core/full_node/test_conditions.py | 2 +- chia/_tests/timelord/test_new_peak.py | 18 +++++------ chia/cmds/data_funcs.py | 2 +- chia/cmds/plotnft_funcs.py | 2 +- chia/cmds/wallet_funcs.py | 32 +++++++++---------- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/chia/_tests/blockchain/test_blockchain.py b/chia/_tests/blockchain/test_blockchain.py index a89e97d1f518..b3ab921830b8 100644 --- a/chia/_tests/blockchain/test_blockchain.py +++ b/chia/_tests/blockchain/test_blockchain.py @@ -77,7 +77,7 @@ async def make_empty_blockchain(constants: ConsensusConstants) -> AsyncIterator[ Provides a list of 10 valid blocks, as well as a blockchain with 9 blocks added to it. """ - async with create_blockchain(constants, 2) as (bc, db_wrapper): + async with create_blockchain(constants, 2) as (bc, _): yield bc @@ -606,7 +606,7 @@ async def do_test_invalid_icc_sub_slot_vdf( ), keychain=keychain, ) - async with create_blockchain(bt_high_iters.constants, db_version) as (bc1, db_wrapper): + async with create_blockchain(bt_high_iters.constants, db_version) as (bc1, _): blocks = bt_high_iters.get_consecutive_blocks(10) for block in blocks: if ( diff --git a/chia/_tests/conftest.py b/chia/_tests/conftest.py index acd07d61ae29..c643d4ac3900 100644 --- a/chia/_tests/conftest.py +++ b/chia/_tests/conftest.py @@ -247,7 +247,7 @@ async def empty_blockchain(latest_db_version, blockchain_constants): """ from chia._tests.util.blockchain import create_blockchain - async with create_blockchain(blockchain_constants, latest_db_version) as (bc1, db_wrapper): + async with create_blockchain(blockchain_constants, latest_db_version) as (bc1, _): yield bc1 diff --git a/chia/_tests/core/full_node/stores/test_full_node_store.py b/chia/_tests/core/full_node/stores/test_full_node_store.py index 37a2a4898102..be9fe45961d0 100644 --- a/chia/_tests/core/full_node/stores/test_full_node_store.py +++ b/chia/_tests/core/full_node/stores/test_full_node_store.py @@ -50,7 +50,7 @@ async def empty_blockchain(db_version: int, blockchain_constants: ConsensusConst DISCRIMINANT_SIZE_BITS=uint16(32), SUB_SLOT_ITERS_STARTING=uint64(2**12), ) - async with create_blockchain(patched_constants, db_version) as (bc1, db_wrapper): + async with create_blockchain(patched_constants, db_version) as (bc1, _): yield bc1 @@ -58,7 +58,7 @@ async def empty_blockchain(db_version: int, blockchain_constants: ConsensusConst async def empty_blockchain_with_original_constants( db_version: int, blockchain_constants: ConsensusConstants ) -> AsyncIterator[Blockchain]: - async with create_blockchain(blockchain_constants, db_version) as (bc1, db_wrapper): + async with create_blockchain(blockchain_constants, db_version) as (bc1, _): yield bc1 diff --git a/chia/_tests/core/full_node/test_conditions.py b/chia/_tests/core/full_node/test_conditions.py index 3801ade8013c..9f220a14a956 100644 --- a/chia/_tests/core/full_node/test_conditions.py +++ b/chia/_tests/core/full_node/test_conditions.py @@ -70,7 +70,7 @@ async def check_spend_bundle_validity( or fails with the correct error code. """ - async with create_ram_blockchain(bt.constants) as (db_wrapper, blockchain): + async with create_ram_blockchain(bt.constants) as (_, blockchain): for block in blocks: await _validate_and_add_block(blockchain, block) diff --git a/chia/_tests/timelord/test_new_peak.py b/chia/_tests/timelord/test_new_peak.py index 1891e0f0cc42..4827ad519248 100644 --- a/chia/_tests/timelord/test_new_peak.py +++ b/chia/_tests/timelord/test_new_peak.py @@ -29,8 +29,8 @@ class TestNewPeak: async def test_timelord_new_peak_basic( self, bt: BlockTools, timelord: tuple[TimelordAPI, ChiaServer], default_1000_blocks: list[FullBlock] ) -> None: - async with create_blockchain(bt.constants, 2) as (b1, db_wrapper1): - async with create_blockchain(bt.constants, 2) as (b2, db_wrapper2): + async with create_blockchain(bt.constants, 2) as (b1, _): + async with create_blockchain(bt.constants, 2) as (b2, _): timelord_api, _ = timelord for block in default_1000_blocks: await _validate_and_add_block(b1, block) @@ -67,7 +67,7 @@ async def test_timelord_new_peak_basic( async def test_timelord_new_peak_unfinished_not_orphaned( self, bt: BlockTools, timelord: tuple[TimelordAPI, ChiaServer], default_1000_blocks: list[FullBlock] ) -> None: - async with create_blockchain(bt.constants, 2) as (b1, db_wrapper1): + async with create_blockchain(bt.constants, 2) as (b1, _): timelord_api, _ = timelord for block in default_1000_blocks: await _validate_and_add_block(b1, block) @@ -122,8 +122,8 @@ async def test_timelord_new_peak_unfinished_orphaned( ) -> None: [full_node_service], _, bt = one_node full_node = full_node_service._node - async with create_blockchain(bt.constants, 2) as (b1, db_wrapper1): - async with create_blockchain(bt.constants, 2) as (b2, db_wrapper2): + async with create_blockchain(bt.constants, 2) as (b1, _): + async with create_blockchain(bt.constants, 2) as (b2, _): timelord_api, _ = timelord for block in default_1000_blocks: await _validate_and_add_block(b1, block) @@ -227,8 +227,8 @@ async def test_timelord_new_peak_unfinished_orphaned( async def test_timelord_new_peak_unfinished_orphaned_overflow( self, bt: BlockTools, timelord: tuple[TimelordAPI, ChiaServer], default_1000_blocks: list[FullBlock] ) -> None: - async with create_blockchain(bt.constants, 2) as (b1, db_wrapper1): - async with create_blockchain(bt.constants, 2) as (b2, db_wrapper2): + async with create_blockchain(bt.constants, 2) as (b1, _): + async with create_blockchain(bt.constants, 2) as (b2, _): timelord_api, _ = timelord for block in default_1000_blocks: await _validate_and_add_block(b1, block) @@ -288,8 +288,8 @@ async def test_timelord_new_peak_unfinished_orphaned_overflow( async def test_timelord_new_peak_unfinished_eos( self, bt: BlockTools, timelord: tuple[TimelordAPI, ChiaServer], default_1000_blocks: list[FullBlock] ) -> None: - async with create_blockchain(bt.constants, 2) as (b1, db_wrapper1): - async with create_blockchain(bt.constants, 2) as (b2, db_wrapper2): + async with create_blockchain(bt.constants, 2) as (b1, _): + async with create_blockchain(bt.constants, 2) as (b2, _): timelord_api, _ = timelord for block in default_1000_blocks: await _validate_and_add_block(b1, block) diff --git a/chia/cmds/data_funcs.py b/chia/cmds/data_funcs.py index 70757ca5ac74..da70886ddea8 100644 --- a/chia/cmds/data_funcs.py +++ b/chia/cmds/data_funcs.py @@ -32,7 +32,7 @@ async def wallet_log_in_cmd( fingerprint: int, root_path: Optional[Path] = None, ) -> None: - async with get_client(rpc_port=rpc_port, fingerprint=fingerprint, root_path=root_path) as (client, _): + async with get_client(rpc_port=rpc_port, fingerprint=fingerprint, root_path=root_path): pass diff --git a/chia/cmds/plotnft_funcs.py b/chia/cmds/plotnft_funcs.py index 8671925b9c66..aa942a7fdb6c 100644 --- a/chia/cmds/plotnft_funcs.py +++ b/chia/cmds/plotnft_funcs.py @@ -200,7 +200,7 @@ async def pprint_all_pool_wallet_state( async def show(wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id_passed_in: Optional[int]) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, _): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): try: async with get_any_service_client(FarmerRpcClient) as (farmer_client, config): address_prefix = config["network_overrides"]["config"][config["selected_network"]]["address_prefix"] diff --git a/chia/cmds/wallet_funcs.py b/chia/cmds/wallet_funcs.py index da407b33bfa7..439cd134cba8 100644 --- a/chia/cmds/wallet_funcs.py +++ b/chia/cmds/wallet_funcs.py @@ -188,7 +188,7 @@ async def get_transactions( reverse: bool, clawback: bool, ) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, config): if paginate is None: paginate = sys.stdout.isatty() type_filter = ( @@ -367,7 +367,7 @@ async def send( async def get_address(wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id: int, new_address: bool) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): res = await wallet_client.get_next_address(wallet_id, new_address) print(res) @@ -660,7 +660,7 @@ async def get_offers( summaries: bool = False, reverse: bool = False, ) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): file_contents: bool = (filepath is not None) or summaries records: list[TradeRecord] = [] if offer_id is None: @@ -960,7 +960,7 @@ async def create_did_wallet( async def did_set_wallet_name(wallet_rpc_port: Optional[int], fp: Optional[int], wallet_id: int, name: str) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): try: await wallet_client.did_set_wallet_name(wallet_id, name) print(f"Successfully set a new name for DID wallet with id {wallet_id}: {name}") @@ -969,7 +969,7 @@ async def did_set_wallet_name(wallet_rpc_port: Optional[int], fp: Optional[int], async def get_did(wallet_rpc_port: Optional[int], fp: Optional[int], did_wallet_id: int) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): try: response = await wallet_client.get_did_id(did_wallet_id) my_did = response["my_did"] @@ -981,7 +981,7 @@ async def get_did(wallet_rpc_port: Optional[int], fp: Optional[int], did_wallet_ async def get_did_info(wallet_rpc_port: Optional[int], fp: Optional[int], coin_id: str, latest: bool) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): did_padding_length = 23 try: response = await wallet_client.get_did_info(coin_id, latest) @@ -1105,7 +1105,7 @@ async def find_lost_did( recovery_list_hash: Optional[str], num_verification: Optional[int], ) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): try: response = await wallet_client.find_lost_did( coin_id, @@ -1124,7 +1124,7 @@ async def find_lost_did( async def create_nft_wallet( wallet_rpc_port: Optional[int], fp: Optional[int], did_id: Optional[CliAddress] = None, name: Optional[str] = None ) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, _): try: response = await wallet_client.create_new_nft_wallet(did_id.original_address if did_id else None, name) wallet_id = response["wallet_id"] @@ -1377,7 +1377,7 @@ async def set_nft_did( async def get_nft_info(wallet_rpc_port: Optional[int], fp: Optional[int], nft_coin_id: str) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, config): try: response = await wallet_client.get_nft_info(nft_coin_id) nft_info = NFTInfo.from_json_dict(response["nft_info"]) @@ -1453,7 +1453,7 @@ async def send_notification( push: bool, condition_valid_times: ConditionValidTimes, ) -> list[TransactionRecord]: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, _): amount: uint64 = cli_amount.convert_amount(units["chia"]) tx = await wallet_client.send_notification( @@ -1478,7 +1478,7 @@ async def get_notifications( start: Optional[int], end: Optional[int], ) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): if ids is not None: ids = None if len(ids) == 0 else list(ids) response = await wallet_client.get_notifications( @@ -1494,7 +1494,7 @@ async def get_notifications( async def delete_notifications( wallet_rpc_port: Optional[int], fp: Optional[int], ids: Sequence[bytes32], delete_all: bool ) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): if delete_all: print(f"Success: {await wallet_client.delete_notifications()}") else: @@ -1511,7 +1511,7 @@ async def sign_message( did_id: Optional[CliAddress] = None, nft_id: Optional[CliAddress] = None, ) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): if addr_type == AddressType.XCH: if address is None: print("Address is required for XCH address type.") @@ -1605,7 +1605,7 @@ async def mint_vc( async def get_vcs(wallet_rpc_port: Optional[int], fp: Optional[int], start: int, count: int) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, config): vc_records, proofs = await wallet_client.vc_get_list(start, count) print("Proofs:") for hash, proof_dict in proofs.items(): @@ -1672,7 +1672,7 @@ async def spend_vc( async def add_proof_reveal( wallet_rpc_port: Optional[int], fp: Optional[int], proofs: Sequence[str], root_only: bool ) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): if len(proofs) == 0: print("Must specify at least one proof") return @@ -1688,7 +1688,7 @@ async def add_proof_reveal( async def get_proofs_for_root(wallet_rpc_port: Optional[int], fp: Optional[int], proof_hash: str) -> None: - async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, fingerprint, config): + async with get_wallet_client(wallet_rpc_port, fp) as (wallet_client, _, _): proof_dict: dict[str, str] = await wallet_client.vc_get_proofs_for_root(bytes32.from_hexstr(proof_hash)) print("Proofs:") for proof in proof_dict: