Skip to content

Conversation

@sca075
Copy link
Owner

@sca075 sca075 commented Aug 28, 2025

Check types and pep8 corrections

sca075 and others added 5 commits July 30, 2025 06:46
correct webp conversion
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* testing new data and async_utils.py

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* Corrections

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* Corrections 2

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* Corrections 3 async methods in auto crop optimize the image output.

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* update toml

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* update battery attributes.

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* update _state_charging

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* update _state_charging convert value to int

Signed-off-by: Sandro Cantarella <sandro@d0c01da6-48fd-4689-9a5c-f5f21d0fdd39.fritz.box>

* correct async_utils.py

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* correct async_utils.py

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* remove old rand25_parser.py

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* rand256 async implemented and introducing pool array.

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* removing memory expensing implemented before, changes in shared.py and added async_get_pil_image to the handlers base class

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* consolidating and renaming async_get_image adding bytes conversion on the go. solving issues on hyper_handler.

Signed-off-by: Sandro Cantarella <sandro@d3548ddd-0920-4ec4-b22e-8d29b286c8c1.fritz.box>

* removed parallel zone clean memory saving

Signed-off-by: Sandro Cantarella <sandro@d3548ddd-0920-4ec4-b22e-8d29b286c8c1.fritz.box>

* memory treat

Signed-off-by: Sandro Cantarella <sandro@d3548ddd-0920-4ec4-b22e-8d29b286c8c1.fritz.box>

* updated tests, and removed panda. Improved drawable.py, reimg_draw.py fix no walls draw

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* ruff format

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* updated init

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* updated init agan

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* project

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* project final

Signed-off-by: Sandro Cantarella <sandro@Sandros-Mac-mini.fritz.box>

* project final

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@d0c01da6-48fd-4689-9a5c-f5f21d0fdd39.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@d3548ddd-0920-4ec4-b22e-8d29b286c8c1.fritz.box>
@sca075 sca075 requested a review from Copilot August 28, 2025 12:39
@sca075 sca075 self-assigned this Aug 28, 2025

This comment was marked as outdated.

@sca075 sca075 changed the base branch from main to dev August 29, 2025 13:39
@sca075 sca075 requested a review from Copilot September 1, 2025 19:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors drawing methods to improve type safety, performance, and code clarity while maintaining compatibility. The changes focus on optimizing performance bottlenecks, adding async utilities, and removing outdated code.

Key changes:

  • Enhanced async utilities for NumPy and PIL operations to improve performance
  • Comprehensive performance profiling system for testing and optimization
  • Refactored drawing algorithms with vectorized operations and better memory management
  • Updated type hints and removed deprecated code

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_rand.py Added comprehensive performance profiling with CPU and memory tracking
tests/test.py Enhanced test suite with configurable profiling and performance metrics
pyproject.toml Version bump from beta to stable release
SCR/valetudo_map_parser/reimg_draw.py Added wall drawing conditional check for drawable elements
SCR/valetudo_map_parser/rand256_handler.py Integrated async utilities and improved image processing
SCR/valetudo_map_parser/hypfer_handler.py Major refactoring with parallel data extraction and memory optimization
SCR/valetudo_map_parser/hypfer_draw.py Optimized drawing algorithms with vectorized operations
SCR/valetudo_map_parser/config/utils.py Added unified async image handling method
SCR/valetudo_map_parser/config/types.py Updated attribute constants for battery and charging
SCR/valetudo_map_parser/config/shared.py Enhanced shared data management with PIL image handling
SCR/valetudo_map_parser/config/rand25_parser.py Removed deprecated parser implementation
SCR/valetudo_map_parser/config/drawable.py Refactored line drawing and zone rendering with optimized algorithms
SCR/valetudo_map_parser/config/auto_crop.py Integrated async utilities for rotation operations
SCR/valetudo_map_parser/config/async_utils.py New async utility module for NumPy and PIL operations
SCR/valetudo_map_parser/init.py Updated exports to reflect new type system
.github/workflows/release.yaml Updated checkout action to v5
.github/workflows/code_quality.yaml Updated checkout action to v5

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


# Load the test.json file
test_file_path = os.path.join(os.path.dirname(__file__), "test.json")
test_file_path = os.path.join(os.path.dirname(__file__), "test.json") #glossyhardtofindnarwhal
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Remove the cryptic comment '#glossyhardtofindnarwhal' as it serves no documentation purpose and appears to be debug remnant.

Suggested change
test_file_path = os.path.join(os.path.dirname(__file__), "test.json") #glossyhardtofindnarwhal
test_file_path = os.path.join(os.path.dirname(__file__), "test.json")

Copilot uses AI. Check for mistakes.

return np_array

def _prepare_xyz_sequences(points: list[int]) -> list[tuple[int, int, int]]:
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This static method incorrectly references self.img_h.data.sublist but is defined as a static method. Either remove the @staticmethod decorator or pass the required data as a parameter.

Suggested change
def _prepare_xyz_sequences(points: list[int]) -> list[tuple[int, int, int]]:
def _prepare_xyz_sequences(self, points: list[int]) -> list[tuple[int, int, int]]:

Copilot uses AI. Check for mistakes.

predicted_path = (paths_data.get("predicted_path") or [])
if predicted_path and "points" in predicted_path[0]:
coords = _prepare_xy_sequences(predicted_path[0]["points"])
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _prepare_xy_sequences is called but is not defined. This should likely be _prepare_xyz_sequences or a similar helper function that handles 2D coordinates.

Copilot uses AI. Check for mistakes.

path_pixels = paths_data.get("path") or []
for path in path_pixels:
coords = _prepare_xy_sequences(path.get("points", []))
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _prepare_xy_sequences is called but is not defined. This should likely be _prepare_xyz_sequences or a similar helper function that handles 2D coordinates.

Copilot uses AI. Check for mistakes.
attrs = {
ATTR_CAMERA_MODE: self.camera_mode,
ATTR_VACUUM_BATTERY: f"{self.vacuum_battery}%",
ATTR_VACUUM_CHARGING: self.vacuum_bat_charged,
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should call the method self.vacuum_bat_charged() with parentheses, not reference the method object itself.

Suggested change
ATTR_VACUUM_CHARGING: self.vacuum_bat_charged,
ATTR_VACUUM_CHARGING: self.vacuum_bat_charged(),

Copilot uses AI. Check for mistakes.
Comment on lines +277 to +280
while True:
# Draw a filled circle for thickness
yy, xx = np.ogrid[-half_w : half_w + 1, -half_w : half_w + 1]
mask = xx**2 + yy**2 <= half_w**2
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a circular mask for every pixel in line drawing is inefficient. Consider pre-computing the mask once and reusing it, or use a simpler approach for thick lines.

Suggested change
while True:
# Draw a filled circle for thickness
yy, xx = np.ogrid[-half_w : half_w + 1, -half_w : half_w + 1]
mask = xx**2 + yy**2 <= half_w**2
# Precompute the circular mask for line thickness
yy, xx = np.ogrid[-half_w : half_w + 1, -half_w : half_w + 1]
mask = xx**2 + yy**2 <= half_w**2
while True:

Copilot uses AI. Check for mistakes.
@sca075 sca075 merged commit 26bfed3 into dev Sep 11, 2025
2 checks passed
@sca075 sca075 deleted the sca075-patch-hyper_draw branch October 18, 2025 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants