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

feat: improve some typing #204

Merged
merged 2 commits into from
May 9, 2024
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
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
Loading