From 1904baff0480931cd8633f4de36c22884700b95b Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Thu, 22 Jun 2023 00:13:34 +0100 Subject: [PATCH] Annotate harvester_rpc_client.py (#15379) Annotate harvester_rpc_client.py. --- chia/rpc/harvester_rpc_client.py | 22 +++++++++++++++++----- mypy-exclusions.txt | 1 - 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/chia/rpc/harvester_rpc_client.py b/chia/rpc/harvester_rpc_client.py index ed38a4b6de..09893c0fe3 100644 --- a/chia/rpc/harvester_rpc_client.py +++ b/chia/rpc/harvester_rpc_client.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, Dict, List +from typing import Any, Dict, List, cast from chia.rpc.rpc_client import RpcClient @@ -21,13 +21,25 @@ class HarvesterRpcClient(RpcClient): await self.fetch("refresh_plots", {}) async def delete_plot(self, filename: str) -> bool: - return (await self.fetch("delete_plot", {"filename": filename}))["success"] + response = await self.fetch("delete_plot", {"filename": filename}) + # TODO: casting due to lack of type checked deserialization + result = cast(bool, response["success"]) + return result async def add_plot_directory(self, dirname: str) -> bool: - return (await self.fetch("add_plot_directory", {"dirname": dirname}))["success"] + response = await self.fetch("add_plot_directory", {"dirname": dirname}) + # TODO: casting due to lack of type checked deserialization + result = cast(bool, response["success"]) + return result async def get_plot_directories(self) -> List[str]: - return (await self.fetch("get_plot_directories", {}))["directories"] + response = await self.fetch("get_plot_directories", {}) + # TODO: casting due to lack of type checked deserialization + result = cast(List[str], response["directories"]) + return result async def remove_plot_directory(self, dirname: str) -> bool: - return (await self.fetch("remove_plot_directory", {"dirname": dirname}))["success"] + response = await self.fetch("remove_plot_directory", {"dirname": dirname}) + # TODO: casting due to lack of type checked deserialization + result = cast(bool, response["success"]) + return result diff --git a/mypy-exclusions.txt b/mypy-exclusions.txt index c804b573c0..a3551c3462 100644 --- a/mypy-exclusions.txt +++ b/mypy-exclusions.txt @@ -16,7 +16,6 @@ chia.plotting.util chia.pools.pool_puzzles chia.pools.pool_wallet chia.pools.pool_wallet_info -chia.rpc.harvester_rpc_client chia.rpc.rpc_client chia.rpc.util chia.rpc.wallet_rpc_api