-
Notifications
You must be signed in to change notification settings - Fork 0
Room Names added to RoomStore. #23
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
Conversation
…ean tested for rand. Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
…unction with C based from mcvrender. Signed-off-by: Sandro Cantarella <sandro@509dc541-f930-4e46-87da-4482e9d9a7bb.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@13de464c-e6f5-4665-b8d7-d6acf4207b24.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@13de464c-e6f5-4665-b8d7-d6acf4207b24.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@03829bc9-740a-4ae1-9848-e7d8baa7c8ba.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@cabf9afe-642b-4ef6-b6d4-34d9c877830b.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@cabf9afe-642b-4ef6-b6d4-34d9c877830b.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@1b7a9c0c-b720-40e5-a6c3-7b3a28793b2e.fritz.box>
WalkthroughAdds a computed property room_names to RoomStore in SCR/valetudo_map_parser/config/types.py to expose a mapping of room identifiers to names, capped at 16 entries. Also updates package version in pyproject.toml from 0.1.11b1 to 0.1.11. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
SCR/valetudo_map_parser/config/types.py (1)
126-127: Add type hints for improved clarity.The return type annotation
dictcan be more specific asdict[str, str]to clarify that both keys and values are strings.Apply this diff to add precise type hints:
@property - def room_names(self) -> dict: + def room_names(self) -> dict[str, str]: """Return room names in format {'room_0_name': 'SegmentID: RoomName', ...}."""
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
SCR/valetudo_map_parser/config/types.py(1 hunks)pyproject.toml(1 hunks)
🔇 Additional comments (2)
pyproject.toml (1)
3-3: LGTM! Standard beta-to-release version bump.The version bump from
0.1.11b1to0.1.11appropriately reflects the transition from beta to a stable release.SCR/valetudo_map_parser/config/types.py (1)
126-136: Guard vacuums_data access with a lock.set_rooms()(lines 117–118) mutatesself.vacuums_datawithout synchronization, androom_names(lines 126–136) reads it unsafely. Confirm there are no concurrent access patterns, or protect both withRoomStore._lock.
| for idx, (segment_id, room_data) in enumerate(self.vacuums_data.items()): | ||
| if idx >= 16: # Max 16 rooms | ||
| break | ||
| room_name = room_data.get("name", f"Room {segment_id}") | ||
| result[f"room_{idx}_name"] = f"{segment_id}: {room_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add defensive check for room_data structure.
If room_data is not a dictionary (e.g., None, string, or other type), line 134 will raise an AttributeError when calling .get(). While the vacuums_data dict is expected to contain dict values, adding a defensive check improves robustness.
Apply this diff to add a type check:
if isinstance(self.vacuums_data, dict):
for idx, (segment_id, room_data) in enumerate(self.vacuums_data.items()):
if idx >= 16: # Max 16 rooms
break
- room_name = room_data.get("name", f"Room {segment_id}")
+ if isinstance(room_data, dict):
+ room_name = room_data.get("name", f"Room {segment_id}")
+ else:
+ room_name = f"Room {segment_id}"
result[f"room_{idx}_name"] = f"{segment_id}: {room_name}"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| for idx, (segment_id, room_data) in enumerate(self.vacuums_data.items()): | |
| if idx >= 16: # Max 16 rooms | |
| break | |
| room_name = room_data.get("name", f"Room {segment_id}") | |
| result[f"room_{idx}_name"] = f"{segment_id}: {room_name}" | |
| if isinstance(self.vacuums_data, dict): | |
| for idx, (segment_id, room_data) in enumerate(self.vacuums_data.items()): | |
| if idx >= 16: # Max 16 rooms | |
| break | |
| if isinstance(room_data, dict): | |
| room_name = room_data.get("name", f"Room {segment_id}") | |
| else: | |
| room_name = f"Room {segment_id}" | |
| result[f"room_{idx}_name"] = f"{segment_id}: {room_name}" |
🤖 Prompt for AI Agents
In SCR/valetudo_map_parser/config/types.py around lines 131 to 135, the loop
assumes room_data is a dict and calls room_data.get(...), which can raise
AttributeError if room_data is None or another type; add a defensive type check
(e.g., if not isinstance(room_data, dict) then treat room_name as a fallback
like str(room_data) or use a default name) before calling .get(), preserve the
existing early-break at 16 rooms, and ensure result[f"room_{idx}_name"] is
always assigned a safe string.
Summary by CodeRabbit