Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate harvester_rpc_client.py #15379

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions chia/rpc/harvester_rpc_client.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -21,13 +21,25 @@ async def refresh_plots(self) -> None:
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
1 change: 0 additions & 1 deletion mypy-exclusions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down