Skip to content

Commit b13c2c8

Browse files
committed
chore: apply github co-pilot recommendation
1 parent 32de01f commit b13c2c8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

roborock/devices/traits/v1/map_content.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
_LOGGER = logging.getLogger(__name__)
1414

15+
_TRUNCATE_LENGTH = 20
16+
1517

1618
@dataclass
1719
class MapContent(RoborockBase):
@@ -26,10 +28,11 @@ class MapContent(RoborockBase):
2628
def __repr__(self) -> str:
2729
"""Return a string representation of the MapContent."""
2830
img = self.image_content
29-
if self.image_content and len(self.image_content) > 20:
30-
img = f"{self.image_content[:17]}..."
31+
if self.image_content and len(self.image_content) > _TRUNCATE_LENGTH:
32+
img = self.image_content[: _TRUNCATE_LENGTH - 3] + b"..."
3133
return f"MapContent(image_content={img!r}, map_data={self.map_data!r})"
3234

35+
3336
@common.map_rpc_channel
3437
class MapContentTrait(MapContent, common.V1TraitMixin):
3538
"""Trait for fetching the map content."""

0 commit comments

Comments
 (0)