Conversation
…ice_info — v0.3.0 - CameraShared.get_content_type() converted to @Property (no parentheses needed) - update_shared_data now reads 'def_context_type' from device_info to initialise image format via set_content_type() — no manual call required after init - utils.py match statement updated to use property form (no parentheses) - tests/test_shared_attributes.py assertions updated to property access - tests/test.py device_info updated with 'def_context_type': 'png', manual set_content_type() call removed - Bump version 0.3.0b2 → 0.3.0 stable
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughConverted CameraShared.get_content_type from a method to a read-only property, updated its call sites, wired device_info to set content type during shared-data initialization, bumped package version to 0.3.0, and added/updated tests and a performance profiler in tests. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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.
Actionable comments posted: 2
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/utils.py (1)
1013-1017:⚠️ Potential issue | 🔴 CriticalInvalid Pillow format:
format="PIL"is not a supported save format.
Image.save(format="PIL")will raise aKeyErrorat runtime — Pillow does not recognize"PIL"as a valid format. The supported formats are"PNG","JPEG","TIFF","GIF","BMP", etc.Additionally, the docstring says "PNG bytes" but the code uses
format="PIL". If the intent is to serialize a PIL Image for reconstruction, usepickleor correct the format to"PNG". Verify the intended behavior and fix accordingly.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@SCR/valetudo_map_parser/config/utils.py` around lines 1013 - 1017, The pil_to_pil_bytes function is using an invalid Pillow format ("PIL") and its docstring claims PNG; change the save call to use a real format like "PNG" and update the docstring accordingly (e.g., pil_img.save(buf, format="PNG", compress_level=compress_level)) so it returns PNG bytes, or if the intent was full Python object serialization instead, replace the implementation with pickle.dumps(pil_img) and adjust the docstring; reference the pil_to_pil_bytes function to make this correction.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@SCR/valetudo_map_parser/config/shared.py`:
- Around line 170-173: The test calls the property get_content_type incorrectly
as a method; update the test in tests/test_shared_attributes.py (around the
assertion on line 100) to access the property without parentheses (use
shared.get_content_type instead of shared.get_content_type()) so it matches the
`@property` on the get_content_type attribute in shared.py and avoids the
TypeError.
- Around line 397-399: Fix the typo when reading the default content type from
device_info: change the key used in the device_info.get call inside the
instance.set_content_type call from "def_context_type" to "def_content_type" so
it matches the rest of the codebase (e.g., ATTR_CONTENT_TYPE, set_content_type,
get_content_type) and correctly supplies the default content type to
instance.set_content_type.
---
Outside diff comments:
In `@SCR/valetudo_map_parser/config/utils.py`:
- Around line 1013-1017: The pil_to_pil_bytes function is using an invalid
Pillow format ("PIL") and its docstring claims PNG; change the save call to use
a real format like "PNG" and update the docstring accordingly (e.g.,
pil_img.save(buf, format="PNG", compress_level=compress_level)) so it returns
PNG bytes, or if the intent was full Python object serialization instead,
replace the implementation with pickle.dumps(pil_img) and adjust the docstring;
reference the pil_to_pil_bytes function to make this correction.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5fdd3a9a-1d41-4181-801f-3393b98eab6d
📒 Files selected for processing (3)
SCR/valetudo_map_parser/config/shared.pySCR/valetudo_map_parser/config/utils.pypyproject.toml
…ice_info — v0.3.0
image format via set_content_type() — no manual call required after init
Summary by CodeRabbit
Releases
Refactor
Bug Fixes
Tests