-
Notifications
You must be signed in to change notification settings - Fork 0
Add floor attribute support to TrimCropData'. #37
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
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@79f3d049-9006-400d-9954-2e5dcd250fa9.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…it bump version in pyproject.toml added to __init__.py Trims and Floor Data Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
…ses old key trims_data Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
Signed-off-by: SCA075 <82227818+sca075@users.noreply.github.com>
📝 WalkthroughWalkthroughChanges introduce floor-level tracking to the trim data system by adding a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
SCR/valetudo_map_parser/config/types.py (1)
83-92: Critical: Add backward compatibility for missing floor field.The
from_dictmethod directly accessesdata["floor"]which will raise aKeyErrorwhen deserializing data that was saved before the floor field was added. This breaks backward compatibility with existing stored configurations.🔧 Proposed fix for backward compatibility
@staticmethod def from_dict(data: dict): """Create dataclass from dictionary.""" return TrimCropData( - floor=data["floor"], + floor=data.get("floor", "floor_0"), trim_left=data["trim_left"], trim_up=data["trim_up"], trim_right=data["trim_right"], trim_down=data["trim_down"], )
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
SCR/valetudo_map_parser/config/types.pySCR/valetudo_map_parser/config/utils.pySCR/valetudo_map_parser/const.pypyproject.toml
🧰 Additional context used
🧬 Code graph analysis (1)
SCR/valetudo_map_parser/config/utils.py (1)
SCR/valetudo_map_parser/config/types.py (3)
TrimsData(293-347)from_list(99-107)from_list(328-338)
🔇 Additional comments (7)
pyproject.toml (2)
3-3: LGTM!Version bump from 0.1.14 to 0.1.15 is appropriate for the floor-tracking feature addition.
21-21: No issues found with mvcrender 0.0.7 dependency.Verification confirms that mvcrender version 0.0.7 exists on PyPI and has no known security vulnerabilities or advisories.
SCR/valetudo_map_parser/const.py (1)
86-86: LGTM!Adding the default floor value
"floor_0"to the trims_data dictionary ensures new trim configurations include floor-level tracking.SCR/valetudo_map_parser/config/types.py (3)
66-67: LGTM!Adding the
floorfield to track floor-level information in the trim data structure is a sensible enhancement.
73-81: LGTM!The
to_dictmethod correctly includes the newfloorfield in the serialized output.
98-107: LGTM!The
from_listmethod correctly accepts an optionalfloorparameter with a sensible default value of"floor_0", maintaining backward compatibility for existing callers.SCR/valetudo_map_parser/config/utils.py (1)
276-280: No action needed—current_flooris always initialized.The attribute
self.shared.current_flooris guaranteed to be a non-None string beforeupdate_trims()is called. It is initialized to"floor_0"in the class definition (line 125 of shared.py) and always set to a string value in thefrom_dictclassmethod (lines 316–327), with fallbacks ensuring"floor_0"is used if the device info does not provide a value. Therefore, there is no risk of passingNonetoTrimsData.from_list().
This pull request:
Summary by CodeRabbit
Release Notes
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.