mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 02:24:23 -05:00
* Tighten up ruff ignore list * Okay that fix was indeed unsafe * enable type-name-incorrect-variance * enable literal-membership * enable non-augmented-assignment * enable useless-return * enable global-variable-not-assigned * - * fixup * Clean up roff.toml from annotations * use ignore instead of explicit re-export * use more descriptive names --------- Co-authored-by: Kyle Altendorf <sda@fstab.net>
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING, Any, ClassVar, Optional, cast
|
|
|
|
from chia.rpc.rpc_server import Endpoint
|
|
from chia.timelord.timelord import Timelord
|
|
from chia.util.ws_message import WsRpcMessage, create_payload_dict
|
|
|
|
|
|
class TimelordRpcApi:
|
|
if TYPE_CHECKING:
|
|
from chia.rpc.rpc_server import RpcApiProtocol
|
|
|
|
_protocol_check: ClassVar[RpcApiProtocol] = cast("TimelordRpcApi", None)
|
|
|
|
def __init__(self, timelord: Timelord):
|
|
self.service = timelord
|
|
self.service_name = "chia_timelord"
|
|
|
|
def get_routes(self) -> dict[str, Endpoint]:
|
|
return {}
|
|
|
|
async def _state_changed(self, change: str, change_data: Optional[dict[str, Any]] = None) -> list[WsRpcMessage]:
|
|
payloads = []
|
|
|
|
if change_data is None:
|
|
change_data = {}
|
|
|
|
if change in {"finished_pot", "new_compact_proof", "skipping_peak", "new_peak"}:
|
|
payloads.append(create_payload_dict(change, change_data, self.service_name, "metrics"))
|
|
|
|
return payloads
|