Skip to content

Commit

Permalink
Use TYPE_CHECKING to work around python 3.8 limitations with generics (
Browse files Browse the repository at this point in the history
…#18152)

* Use TYPE_CHECKING to work around python 3.8 limitations with generics

* Add comment about 3.8 specific workaround
  • Loading branch information
emlowe authored Jun 12, 2024
1 parent 1e67783 commit 2fe2818
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions chia/_tests/wallet/test_new_wallet_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from asyncio import Queue
from dataclasses import dataclass
from random import Random
from typing import AsyncGenerator, Dict, List, Optional, OrderedDict, Set, Tuple
from typing import TYPE_CHECKING, AsyncGenerator, Dict, List, Optional, OrderedDict, Set, Tuple

import pytest
from chia_rs import AugSchemeMPL, Coin, CoinSpend, CoinState, Program
Expand Down Expand Up @@ -33,6 +33,11 @@
IDENTITY_PUZZLE_HASH = IDENTITY_PUZZLE.get_tree_hash()

OneNode = Tuple[List[SimulatorFullNodeService], List[WalletService], BlockTools]
# python 3.8 workaround follows - can be removed when 3.8 support is removed
if TYPE_CHECKING:
Mpu = Tuple[FullNodeSimulator, Queue[Message], WSChiaConnection]
else:
Mpu = Tuple[FullNodeSimulator, Queue, WSChiaConnection]

ALL_FILTER = wallet_protocol.CoinStateFilters(True, True, True, uint64(0))

Expand Down Expand Up @@ -798,9 +803,6 @@ async def assert_mempool_removed(
assert set(update.removed_items) == removed_items


Mpu = Tuple[FullNodeSimulator, Queue[Message], WSChiaConnection]


@pytest.fixture
async def mpu_setup(one_node: OneNode, self_hostname: str) -> Mpu:
return await raw_mpu_setup(one_node, self_hostname)
Expand Down

0 comments on commit 2fe2818

Please sign in to comment.