Skip to content

Commit

Permalink
feat: improve some typing (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lash-L authored May 9, 2024
1 parent 459782e commit 7752db9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions roborock/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def __init__(self, endpoint: str, device_info: DeviceData, queue_timeout: int =
def __del__(self) -> None:
self.release()

def release(self):
def release(self) -> None:
self.sync_disconnect()

async def async_release(self):
async def async_release(self) -> None:
await self.async_disconnect()

@property
Expand Down
2 changes: 1 addition & 1 deletion roborock/version_1_apis/roborock_mqtt_client_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ async def _send_command(
roborock_message = RoborockMessage(timestamp=timestamp, protocol=request_protocol, payload=payload)
return await self.send_message(roborock_message)

async def get_map_v1(self):
async def get_map_v1(self) -> bytes | None:
return await self.send_command(RoborockCommand.GET_MAP_V1)
4 changes: 3 additions & 1 deletion roborock/version_a01_apis/roborock_client_a01.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def on_message_received(self, messages: list[RoborockMessage]) -> None:
if queue and queue.protocol == protocol:
queue.resolve((converted_response, None))

async def update_values(self, dyad_data_protocols: list[RoborockDyadDataProtocol | RoborockZeoProtocol]):
async def update_values(
self, dyad_data_protocols: list[RoborockDyadDataProtocol | RoborockZeoProtocol]
) -> dict[RoborockDyadDataProtocol | RoborockZeoProtocol, typing.Any]:
"""This should handle updating for each given protocol."""
raise NotImplementedError
4 changes: 3 additions & 1 deletion roborock/version_a01_apis/roborock_mqtt_client_a01.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ async def send_message(self, roborock_message: RoborockMessage):
dps_responses[dps] = response[0]
return dps_responses

async def update_values(self, dyad_data_protocols: list[RoborockDyadDataProtocol | RoborockZeoProtocol]):
async def update_values(
self, dyad_data_protocols: list[RoborockDyadDataProtocol | RoborockZeoProtocol]
) -> dict[RoborockDyadDataProtocol | RoborockZeoProtocol, typing.Any]:
payload = {"dps": {RoborockDyadDataProtocol.ID_QUERY: str([int(protocol) for protocol in dyad_data_protocols])}}
return await self.send_message(
RoborockMessage(
Expand Down

0 comments on commit 7752db9

Please sign in to comment.