Skip to content

Commit cc755d1

Browse files
committed
refactor: remove redundant map content parsing methods and update calls to use the converter directly.
1 parent 8947c6c commit cc755d1

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

roborock/devices/traits/v1/home.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def discover_home(self) -> None:
9393
self._discovery_completed = True
9494
try:
9595
self._home_map_content = {
96-
k: self._map_content.parse_map_content(base64.b64decode(v))
96+
k: self._map_content.converter.parse_map_content(base64.b64decode(v))
9797
for k, v in (device_cache_data.home_map_content_base64 or {}).items()
9898
}
9999
except (ValueError, RoborockException) as ex:

roborock/devices/traits/v1/map_content.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,3 @@ def __init__(self, map_parser_config: MapParserConfig | None = None) -> None:
9090
"""Initialize MapContentTrait."""
9191
super().__init__()
9292
self.converter = MapContentConverter(MapParser(map_parser_config or MapParserConfig()))
93-
94-
def _convert(self, response: common.V1ResponseData) -> MapContent:
95-
"""Parse the response from the device into a MapContentTrait instance."""
96-
if not isinstance(response, bytes):
97-
raise ValueError(f"Unexpected MapContentTrait response format: {type(response)}")
98-
return self.parse_map_content(response)
99-
100-
def parse_map_content(self, response: bytes) -> MapContent:
101-
"""Parse the map content from raw bytes.
102-
103-
This method is exposed so that cached map data can be parsed without
104-
needing to go through the RPC channel.
105-
106-
Args:
107-
response: The raw bytes of the map data from the API.
108-
109-
Returns:
110-
MapContent: The parsed map content.
111-
112-
Raises:
113-
RoborockException: If the map data cannot be parsed.
114-
"""
115-
return self.converter.parse_map_content(response)

0 commit comments

Comments
 (0)