Skip to content

Commit

Permalink
Manually fix tuples with as
Browse files Browse the repository at this point in the history
  • Loading branch information
Quexington committed Oct 31, 2024
1 parent 5bdf1f4 commit 339a617
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions chia/_tests/blockchain/test_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions chia/_tests/core/full_node/stores/test_full_node_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ 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


@pytest.fixture(scope="function")
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


Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/core/full_node/test_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
18 changes: 9 additions & 9 deletions chia/_tests/timelord/test_new_peak.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/data_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion chia/cmds/plotnft_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
32 changes: 16 additions & 16 deletions chia/cmds/wallet_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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}")
Expand All @@ -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"]
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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"]
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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:
Expand All @@ -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.")
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 339a617

Please sign in to comment.