Skip to content

Commit 27209c8

Browse files
committed
lint
1 parent b0aac77 commit 27209c8

File tree

5 files changed

+20
-35
lines changed

5 files changed

+20
-35
lines changed

chia/protocols/farmer_protocol.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ class SignedValues(Streamable):
107107
foliage_transaction_block_signature: G2Element
108108

109109

110-
111110
@streamable
112111
@dataclass(frozen=True)
113112
class SolutionResponse(Streamable):
114-
proof: bytes
113+
proof: bytes

chia/protocols/solver_protocol.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
from __future__ import annotations
12

23
from dataclasses import dataclass
34

45
from chia_rs import PlotSize
56
from chia_rs.sized_bytes import bytes32
67
from chia_rs.sized_ints import uint64
7-
from chia.util.streamable import Streamable, streamable
8-
98

9+
from chia.util.streamable import Streamable, streamable
1010

1111

1212
@streamable
1313
@dataclass(frozen=True)
1414
class SolverInfo(Streamable):
15-
plot_size: PlotSize
15+
plot_size: PlotSize
1616
plot_diffculty: uint64
17-
quality_string: bytes32
17+
quality_string: bytes32

chia/solver/__init__.py

Whitespace-only changes.

chia/solver/solver.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,35 @@
88
from concurrent.futures.thread import ThreadPoolExecutor
99
from pathlib import Path
1010
from typing import TYPE_CHECKING, Any, ClassVar, Optional, cast
11+
1112
from chia_rs import ConsensusConstants
12-
from chia.protocols.solver_protocol import SolverInfo
13+
1314
from chia.protocols.outbound_message import NodeType
15+
from chia.protocols.solver_protocol import SolverInfo
1416
from chia.rpc.rpc_server import StateChangedProtocol, default_get_connections
1517
from chia.server.server import ChiaServer
1618
from chia.server.ws_connection import WSChiaConnection
1719

18-
1920
log = logging.getLogger(__name__)
2021

2122

2223
class Solver:
2324
if TYPE_CHECKING:
2425
from chia.rpc.rpc_server import RpcServiceProtocol
26+
2527
_protocol_check: ClassVar[RpcServiceProtocol] = cast("Solver", None)
2628

2729
root_path: Path
28-
_server: Optional[ChiaServer]
30+
_server: Optional[ChiaServer]
2931
_shut_down: bool
3032
started: bool = False
3133
executor: ThreadPoolExecutor
3234
state_changed_callback: Optional[StateChangedProtocol] = None
3335
constants: ConsensusConstants
3436
event_loop: asyncio.events.AbstractEventLoop
35-
36-
3737

3838
@property
39-
def server(self) -> ChiaServer:
39+
def server(self) -> ChiaServer:
4040
if self._server is None:
4141
raise RuntimeError("server not assigned")
4242

@@ -52,8 +52,6 @@ def __init__(self, root_path: Path, config: dict[str, Any], constants: Consensus
5252
self._server = None
5353
self.constants = constants
5454
self.state_changed_callback: Optional[StateChangedProtocol] = None
55-
56-
5755

5856
@contextlib.asynccontextmanager
5957
async def manage(self) -> AsyncIterator[None]:
@@ -63,7 +61,7 @@ async def manage(self) -> AsyncIterator[None]:
6361
finally:
6462
self._shut_down = True
6563

66-
def solve(self, info: SolverInfo) -> Optional[bytes]:
64+
def solve(self, info: SolverInfo) -> Optional[bytes]:
6765
return None
6866

6967
def get_connections(self, request_node_type: Optional[NodeType]) -> list[dict[str, Any]]:
@@ -72,14 +70,11 @@ def get_connections(self, request_node_type: Optional[NodeType]) -> list[dict[st
7270
async def on_connect(self, connection: WSChiaConnection) -> None:
7371
pass
7472

75-
7673
async def on_disconnect(self, connection: WSChiaConnection) -> None:
7774
self.log.info(f"peer disconnected {connection.get_peer_logging()}")
78-
7975

8076
def set_server(self, server: ChiaServer) -> None:
8177
self._server = server
8278

8379
def _set_state_changed_callback(self, callback: StateChangedProtocol) -> None:
8480
self.state_changed_callback = callback
85-

chia/solver/solver_api.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
from __future__ import annotations
22

3-
import json
43
import logging
5-
import time
6-
from typing import TYPE_CHECKING, Any, ClassVar, Optional, Union, cast
4+
from typing import TYPE_CHECKING, ClassVar, Optional, cast
75

8-
import aiohttp
9-
from chia.protocols.outbound_message import make_msg
10-
from chia_rs.sized_bytes import bytes32
11-
from chia_rs.sized_ints import uint8, uint16, uint32, uint64
12-
13-
from chia import __version__
146
from chia.protocols.farmer_protocol import SolutionResponse
15-
from chia.protocols.outbound_message import Message
7+
from chia.protocols.outbound_message import Message, make_msg
168
from chia.protocols.protocol_message_types import ProtocolMessageTypes
179
from chia.protocols.solver_protocol import SolverInfo
1810
from chia.server.api_protocol import ApiMetadata
1911
from chia.solver.solver import Solver
2012

2113

22-
2314
class SolverAPI:
2415
if TYPE_CHECKING:
2516
from chia.server.api_protocol import ApiProtocol
17+
2618
_protocol_check: ClassVar[ApiProtocol] = cast("SolverAPI", None)
2719

2820
log: logging.Logger
@@ -40,16 +32,15 @@ def ready(self) -> bool:
4032
async def solve(
4133
self,
4234
request: SolverInfo,
43-
) -> Optional[Message]:
35+
) -> Optional[Message]:
4436
if not self.solver.started:
4537
raise RuntimeError("Solver is not started")
4638

4739
proof = self.solver.solve(request)
4840
if proof is None:
49-
return None
50-
41+
return None
42+
5143
response: SolutionResponse = SolutionResponse(
5244
proof=proof,
53-
)
54-
return make_msg(ProtocolMessageTypes.solution_resonse,response)
55-
45+
)
46+
return make_msg(ProtocolMessageTypes.solution_resonse, response)

0 commit comments

Comments
 (0)