Files
chia-blockchain/chia/_tests/environments/common.py
Kyle AltendorfandGitHub 9c8557a1f8 Remove Python 3.8 support and update source to 3.9 standards (#18687)
* manual python 3.8 removals

* poetry

* pyupgrade

* black

* isort

* manually tidy imports

* work around shadowed type

* catch up build network protocol files for pyupgrade changes

* placate pylint

* re-enable 20.04

* placate flake8
2024-10-16 14:21:15 -07:00

36 lines
959 B
Python

from __future__ import annotations
from dataclasses import dataclass
from typing import ClassVar, Protocol, TypeVar
from chia.rpc.rpc_server import RpcApiProtocol, RpcServer, RpcServiceProtocol
from chia.server.api_protocol import ApiProtocol
from chia.server.server import ChiaServer
from chia.server.start_service import Service
T_Node = TypeVar("T_Node", bound=RpcServiceProtocol)
T_RpcApi = TypeVar("T_RpcApi", bound=RpcApiProtocol)
T_PeerApi = TypeVar("T_PeerApi", bound=ApiProtocol)
@dataclass
class ServiceEnvironment(Protocol[T_Node, T_RpcApi, T_PeerApi]):
service: Service[T_Node, T_PeerApi, T_RpcApi]
__match_args__: ClassVar[tuple[str, ...]] = ()
@property
def node(self) -> T_Node: ...
@property
def rpc_api(self) -> T_RpcApi: ...
@property
def rpc_server(self) -> RpcServer[T_RpcApi]: ...
@property
def peer_api(self) -> T_PeerApi: ...
@property
def peer_server(self) -> ChiaServer: ...