valetudo-map-parser 0.1.9b22__py3-none-any.whl → 0.1.9b23__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- valetudo_map_parser/__init__.py +1 -0
- valetudo_map_parser/config/auto_crop.py +1 -0
- valetudo_map_parser/config/colors.py +1 -0
- valetudo_map_parser/config/rand25_parser.py +1 -0
- valetudo_map_parser/config/shared.py +11 -1
- valetudo_map_parser/config/types.py +11 -0
- valetudo_map_parser/config/utils.py +21 -18
- valetudo_map_parser/hypfer_draw.py +1 -0
- valetudo_map_parser/hypfer_handler.py +1 -0
- valetudo_map_parser/rand25_handler.py +1 -0
- valetudo_map_parser/reimg_draw.py +1 -0
- {valetudo_map_parser-0.1.9b22.dist-info → valetudo_map_parser-0.1.9b23.dist-info}/METADATA +1 -1
- valetudo_map_parser-0.1.9b23.dist-info/RECORD +20 -0
- valetudo_map_parser-0.1.9b22.dist-info/RECORD +0 -20
- {valetudo_map_parser-0.1.9b22.dist-info → valetudo_map_parser-0.1.9b23.dist-info}/LICENSE +0 -0
- {valetudo_map_parser-0.1.9b22.dist-info → valetudo_map_parser-0.1.9b23.dist-info}/NOTICE.txt +0 -0
- {valetudo_map_parser-0.1.9b22.dist-info → valetudo_map_parser-0.1.9b23.dist-info}/WHEEL +0 -0
    
        valetudo_map_parser/__init__.py
    CHANGED
    
    
| @@ -6,6 +6,7 @@ Version: v2024.12.0 | |
| 6 6 |  | 
| 7 7 | 
             
            import asyncio
         | 
| 8 8 | 
             
            import logging
         | 
| 9 | 
            +
            from typing import Dict, List
         | 
| 9 10 |  | 
| 10 11 | 
             
            from .types import (
         | 
| 11 12 | 
             
                ATTR_CALIBRATION_POINTS,
         | 
| @@ -36,8 +37,10 @@ from .types import ( | |
| 36 37 | 
             
                DEFAULT_VALUES,
         | 
| 37 38 | 
             
                CameraModes,
         | 
| 38 39 | 
             
                Colors,
         | 
| 40 | 
            +
                TrimsData,
         | 
| 39 41 | 
             
            )
         | 
| 40 42 |  | 
| 43 | 
            +
             | 
| 41 44 | 
             
            _LOGGER = logging.getLogger(__name__)
         | 
| 42 45 |  | 
| 43 46 |  | 
| @@ -99,8 +102,15 @@ class CameraShared: | |
| 99 102 | 
             
                    self.map_pred_points = None  # Predefined points data
         | 
| 100 103 | 
             
                    self.map_new_path = None  # New path data
         | 
| 101 104 | 
             
                    self.map_old_path = None  # Old path data
         | 
| 102 | 
            -
                    self.trim_crop_data = None
         | 
| 103 105 | 
             
                    self.user_language = None  # User language
         | 
| 106 | 
            +
                    self.trim_crop_data = None
         | 
| 107 | 
            +
                    self.trims: Dict[TrimsData, int] = {
         | 
| 108 | 
            +
                        TrimsData.TRIM_LEFT: 0,
         | 
| 109 | 
            +
                        TrimsData.TRIM_UP: 0,
         | 
| 110 | 
            +
                        TrimsData.TRIM_RIGHT: 0,
         | 
| 111 | 
            +
                        TrimsData.TRIM_DOWN: 0,
         | 
| 112 | 
            +
                    }
         | 
| 113 | 
            +
                    self.skip_room_ids: List[str] = []
         | 
| 104 114 |  | 
| 105 115 | 
             
                def update_user_colors(self, user_colors):
         | 
| 106 116 | 
             
                    """Update the user colors."""
         | 
| @@ -7,11 +7,13 @@ import asyncio | |
| 7 7 | 
             
            import json
         | 
| 8 8 | 
             
            import logging
         | 
| 9 9 | 
             
            from dataclasses import dataclass
         | 
| 10 | 
            +
            from enum import Enum
         | 
| 10 11 | 
             
            from typing import Any, Dict, Tuple, Union
         | 
| 11 12 |  | 
| 12 13 | 
             
            import numpy as np
         | 
| 13 14 | 
             
            from PIL import Image
         | 
| 14 15 |  | 
| 16 | 
            +
             | 
| 15 17 | 
             
            DEFAULT_ROOMS = 1
         | 
| 16 18 |  | 
| 17 19 | 
             
            MY_LOGGER = logging.getLogger(__name__)
         | 
| @@ -587,3 +589,12 @@ class CameraModes: | |
| 587 589 | 
             
                CAMERA_STANDBY = "camera_standby"
         | 
| 588 590 | 
             
                CAMERA_OFF = False
         | 
| 589 591 | 
             
                CAMERA_ON = True
         | 
| 592 | 
            +
             | 
| 593 | 
            +
             | 
| 594 | 
            +
            class TrimsData(Enum):
         | 
| 595 | 
            +
                """Constants for the trims data."""
         | 
| 596 | 
            +
             | 
| 597 | 
            +
                TRIM_LEFT = "trim_left"
         | 
| 598 | 
            +
                TRIM_UP = "trim_up"
         | 
| 599 | 
            +
                TRIM_RIGHT = "trim_right"
         | 
| 600 | 
            +
                TRIM_DOWN = "trim_down"
         | 
| @@ -4,10 +4,12 @@ import hashlib | |
| 4 4 | 
             
            import json
         | 
| 5 5 | 
             
            from dataclasses import dataclass
         | 
| 6 6 | 
             
            from logging import getLogger
         | 
| 7 | 
            +
            from typing import Callable, List, Optional
         | 
| 7 8 |  | 
| 8 | 
            -
            from PIL import  | 
| 9 | 
            +
            from PIL import ImageOps
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            from .types import ChargerPosition, ImageSize, NumpyArray, PilPNG, RobotPosition
         | 
| 9 12 |  | 
| 10 | 
            -
            from .types import ChargerPosition, ImageSize, NumpyArray, RobotPosition
         | 
| 11 13 |  | 
| 12 14 | 
             
            _LOGGER = getLogger(__name__)
         | 
| 13 15 |  | 
| @@ -16,13 +18,13 @@ _LOGGER = getLogger(__name__) | |
| 16 18 | 
             
            class ResizeParams:
         | 
| 17 19 | 
             
                """Resize the image to the given dimensions and aspect ratio."""
         | 
| 18 20 |  | 
| 19 | 
            -
                pil_img:  | 
| 21 | 
            +
                pil_img: PilPNG
         | 
| 20 22 | 
             
                width: int
         | 
| 21 23 | 
             
                height: int
         | 
| 22 | 
            -
                aspect_ratio: str | 
| 23 | 
            -
                crop_size:  | 
| 24 | 
            -
                is_rand: bool = False
         | 
| 25 | 
            -
                offset_func:  | 
| 24 | 
            +
                aspect_ratio: str
         | 
| 25 | 
            +
                crop_size: List[int]
         | 
| 26 | 
            +
                is_rand: Optional[bool] = False
         | 
| 27 | 
            +
                offset_func: Optional[Callable] = None
         | 
| 26 28 |  | 
| 27 29 |  | 
| 28 30 | 
             
            @dataclass
         | 
| @@ -33,7 +35,7 @@ class OffsetParams: | |
| 33 35 | 
             
                hsf: int
         | 
| 34 36 | 
             
                width: int
         | 
| 35 37 | 
             
                height: int
         | 
| 36 | 
            -
                rand256: bool = False
         | 
| 38 | 
            +
                rand256: Optional[bool] = False
         | 
| 37 39 |  | 
| 38 40 |  | 
| 39 41 | 
             
            class BaseHandler:
         | 
| @@ -91,7 +93,7 @@ class BaseHandler: | |
| 91 93 | 
             
                    )
         | 
| 92 94 |  | 
| 93 95 | 
             
                def _set_image_offset_ratio_1_1(
         | 
| 94 | 
            -
                    self, width: int, height: int, rand256: bool = False
         | 
| 96 | 
            +
                    self, width: int, height: int, rand256: Optional[bool] = False
         | 
| 95 97 | 
             
                ) -> None:
         | 
| 96 98 | 
             
                    """Set the image offset ratio to 1:1."""
         | 
| 97 99 |  | 
| @@ -118,7 +120,7 @@ class BaseHandler: | |
| 118 120 | 
             
                    )
         | 
| 119 121 |  | 
| 120 122 | 
             
                def _set_image_offset_ratio_2_1(
         | 
| 121 | 
            -
                    self, width: int, height: int, rand256: bool = False
         | 
| 123 | 
            +
                    self, width: int, height: int, rand256: Optional[bool] = False
         | 
| 122 124 | 
             
                ) -> None:
         | 
| 123 125 | 
             
                    """Set the image offset ratio to 2:1."""
         | 
| 124 126 |  | 
| @@ -146,7 +148,7 @@ class BaseHandler: | |
| 146 148 | 
             
                    )
         | 
| 147 149 |  | 
| 148 150 | 
             
                def _set_image_offset_ratio_3_2(
         | 
| 149 | 
            -
                    self, width: int, height: int, rand256: bool = False
         | 
| 151 | 
            +
                    self, width: int, height: int, rand256: Optional[bool] = False
         | 
| 150 152 | 
             
                ) -> None:
         | 
| 151 153 | 
             
                    """Set the image offset ratio to 3:2."""
         | 
| 152 154 |  | 
| @@ -177,7 +179,7 @@ class BaseHandler: | |
| 177 179 | 
             
                    )
         | 
| 178 180 |  | 
| 179 181 | 
             
                def _set_image_offset_ratio_5_4(
         | 
| 180 | 
            -
                    self, width: int, height: int, rand256: bool = False
         | 
| 182 | 
            +
                    self, width: int, height: int, rand256: Optional[bool] = False
         | 
| 181 183 | 
             
                ) -> None:
         | 
| 182 184 | 
             
                    """Set the image offset ratio to 5:4."""
         | 
| 183 185 |  | 
| @@ -209,7 +211,7 @@ class BaseHandler: | |
| 209 211 | 
             
                    )
         | 
| 210 212 |  | 
| 211 213 | 
             
                def _set_image_offset_ratio_9_16(
         | 
| 212 | 
            -
                    self, width: int, height: int, rand256: bool = False
         | 
| 214 | 
            +
                    self, width: int, height: int, rand256: Optional[bool] = False
         | 
| 213 215 | 
             
                ) -> None:
         | 
| 214 216 | 
             
                    """Set the image offset ratio to 9:16."""
         | 
| 215 217 |  | 
| @@ -237,7 +239,7 @@ class BaseHandler: | |
| 237 239 | 
             
                    )
         | 
| 238 240 |  | 
| 239 241 | 
             
                def _set_image_offset_ratio_16_9(
         | 
| 240 | 
            -
                    self, width: int, height: int, rand256: bool = False
         | 
| 242 | 
            +
                    self, width: int, height: int, rand256: Optional[bool] = False
         | 
| 241 243 | 
             
                ) -> None:
         | 
| 242 244 | 
             
                    """Set the image offset ratio to 16:9."""
         | 
| 243 245 |  | 
| @@ -298,8 +300,8 @@ class BaseHandler: | |
| 298 300 |  | 
| 299 301 | 
             
                @staticmethod
         | 
| 300 302 | 
             
                async def calculate_array_hash(
         | 
| 301 | 
            -
                    layers: dict, active:  | 
| 302 | 
            -
                ) -> str  | 
| 303 | 
            +
                    layers: dict, active: Optional[List[int]]
         | 
| 304 | 
            +
                ) -> str | None:
         | 
| 303 305 | 
             
                    """Calculate the hash of the image based on layers and active zones."""
         | 
| 304 306 | 
             
                    if layers and active:
         | 
| 305 307 | 
             
                        data_to_hash = {
         | 
| @@ -499,7 +501,7 @@ async def async_resize_image(params: ResizeParams): | |
| 499 501 | 
             
                        str(hsf),
         | 
| 500 502 | 
             
                    )
         | 
| 501 503 |  | 
| 502 | 
            -
                    if params.crop_size is not None:
         | 
| 504 | 
            +
                    if (params.crop_size is not None) and (params.offset_func is not None):
         | 
| 503 505 | 
             
                        offset = OffsetParams(wsf, hsf, new_width, new_height, params.is_rand)
         | 
| 504 506 | 
             
                        params.crop_size[0], params.crop_size[1] = await params.offset_func(offset)
         | 
| 505 507 |  | 
| @@ -507,6 +509,7 @@ async def async_resize_image(params: ResizeParams): | |
| 507 509 |  | 
| 508 510 | 
             
                return ImageOps.pad(params.pil_img, (params.width, params.height))
         | 
| 509 511 |  | 
| 512 | 
            +
             | 
| 510 513 | 
             
            def prepare_resize_params(handler, pil_img, rand):
         | 
| 511 514 | 
             
                """Prepare resize parameters for image resizing."""
         | 
| 512 515 | 
             
                return ResizeParams(
         | 
| @@ -516,5 +519,5 @@ def prepare_resize_params(handler, pil_img, rand): | |
| 516 519 | 
             
                    aspect_ratio=handler.shared.image_aspect_ratio,
         | 
| 517 520 | 
             
                    crop_size=handler.crop_img_size,
         | 
| 518 521 | 
             
                    offset_func=handler.async_map_coordinates_offset,
         | 
| 519 | 
            -
                    is_rand=rand
         | 
| 522 | 
            +
                    is_rand=rand,
         | 
| 520 523 | 
             
                )
         | 
| @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            valetudo_map_parser/__init__.py,sha256=Wmd20bdI1btzMq-0x8NxGYWskTjdUmD-Fem9MTfziwU,810
         | 
| 2 | 
            +
            valetudo_map_parser/config/__init__.py,sha256=DQ9plV3ZF_K25Dp5ZQHPDoG-40dQoJNdNi-dfNeR3Zc,48
         | 
| 3 | 
            +
            valetudo_map_parser/config/auto_crop.py,sha256=OCEUxmqaCy4jbuIkXFuutJ2W3usarfowEJBXKak-1nw,11019
         | 
| 4 | 
            +
            valetudo_map_parser/config/colors.py,sha256=IzTT9JvF12YGGJxaTiEJRuwUdCCsFCLzsR9seCDfYWs,6515
         | 
| 5 | 
            +
            valetudo_map_parser/config/drawable.py,sha256=hsrEJCMVOrjs5sJfr26SeqJD0VNlYWwxcVkkHeaxx7U,20356
         | 
| 6 | 
            +
            valetudo_map_parser/config/rand25_parser.py,sha256=kIayyqVZBfQfAMkiArzqrrj9vqZB3pkgT0Y5ufrQmGA,16448
         | 
| 7 | 
            +
            valetudo_map_parser/config/shared.py,sha256=BPfkcsfZnWqiwCfTECyXw-8LX9NFc6SuwiYU99cbWtE,9735
         | 
| 8 | 
            +
            valetudo_map_parser/config/types.py,sha256=VWzrR0xzlcTBdL9Eu6hJLpVjO0YusQomR1vOIj1g2a0,16306
         | 
| 9 | 
            +
            valetudo_map_parser/config/utils.py,sha256=8TBqH5jKr7wMM5dtWqnk5pPwZa_D0ApOpmdZUaqiRl8,18679
         | 
| 10 | 
            +
            valetudo_map_parser/hypfer_draw.py,sha256=1trtil-CQcDSiAMBWPBmuP5L9MWHGTp5OlY7MX8FgDg,14932
         | 
| 11 | 
            +
            valetudo_map_parser/hypfer_handler.py,sha256=dW3EKF-Hc8OT74IcUXk8faPx4CvhkL3WH79tq_bLCfw,13516
         | 
| 12 | 
            +
            valetudo_map_parser/map_data.py,sha256=6FbQfgxFB6E4kcOWokReJOVSekVaE1kStyhTQhAhiOg,19469
         | 
| 13 | 
            +
            valetudo_map_parser/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 14 | 
            +
            valetudo_map_parser/rand25_handler.py,sha256=N0i4JBnX5UY-TMpRa11oXE6DrjIU3fqSM89aaKVP0Eo,15318
         | 
| 15 | 
            +
            valetudo_map_parser/reimg_draw.py,sha256=V0JUASavKVnEtAhv7nOV4pjsRxZrNsjIUtctbKO8wvk,12507
         | 
| 16 | 
            +
            valetudo_map_parser-0.1.9b23.dist-info/LICENSE,sha256=Lh-qBbuRV0-jiCIBhfV7NgdwFxQFOXH3BKOzK865hRs,10480
         | 
| 17 | 
            +
            valetudo_map_parser-0.1.9b23.dist-info/METADATA,sha256=xTp6WcfWrNFVtRMW58-WAZZqAd2_VSbH-sJfG4Rjyhc,1029
         | 
| 18 | 
            +
            valetudo_map_parser-0.1.9b23.dist-info/NOTICE.txt,sha256=5lTOuWiU9aiEnJ2go8sc7lTJ7ntMBx0g0GFnNrswCY4,2533
         | 
| 19 | 
            +
            valetudo_map_parser-0.1.9b23.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
         | 
| 20 | 
            +
            valetudo_map_parser-0.1.9b23.dist-info/RECORD,,
         | 
| @@ -1,20 +0,0 @@ | |
| 1 | 
            -
            valetudo_map_parser/__init__.py,sha256=pWRSVGM2OtPKTzdpPTEgLrNYjZ9P2duwaDLI_KN-iLY,809
         | 
| 2 | 
            -
            valetudo_map_parser/config/__init__.py,sha256=DQ9plV3ZF_K25Dp5ZQHPDoG-40dQoJNdNi-dfNeR3Zc,48
         | 
| 3 | 
            -
            valetudo_map_parser/config/auto_crop.py,sha256=z97Yqoe96ZiWmgaKTFv7sODb9UD6doRduTeQXMYWXVA,11018
         | 
| 4 | 
            -
            valetudo_map_parser/config/colors.py,sha256=0sTI_x0ZMchSDPTsEivdTXDn58nEbyE4REXIp0IpWdg,6514
         | 
| 5 | 
            -
            valetudo_map_parser/config/drawable.py,sha256=hsrEJCMVOrjs5sJfr26SeqJD0VNlYWwxcVkkHeaxx7U,20356
         | 
| 6 | 
            -
            valetudo_map_parser/config/rand25_parser.py,sha256=fehyF18hRWRWbXbojocQCIaIch21Lbh1wtl2XdKRSl0,16447
         | 
| 7 | 
            -
            valetudo_map_parser/config/shared.py,sha256=LQV5K8tbVhEKUkby9ssjEmh_T4Ai-Euzsbag_HWYVRc,9448
         | 
| 8 | 
            -
            valetudo_map_parser/config/types.py,sha256=sdjqhcxpRSxNFLVHIyCg-RDL9JIjtQHoR2C2WpocWBc,16107
         | 
| 9 | 
            -
            valetudo_map_parser/config/utils.py,sha256=QHF0rx72TS0Kpt2iTqqFwr6MlV0TJXK6-_008wDg8nU,18573
         | 
| 10 | 
            -
            valetudo_map_parser/hypfer_draw.py,sha256=s58ak9IBYLjJyoddfDC99PfQ12HTjkSfJYXqCi4vZKs,14931
         | 
| 11 | 
            -
            valetudo_map_parser/hypfer_handler.py,sha256=8uAPum9JK_JDDSEoD_gLGxMRvdOg4oAABqc3PvW-GTs,13515
         | 
| 12 | 
            -
            valetudo_map_parser/map_data.py,sha256=6FbQfgxFB6E4kcOWokReJOVSekVaE1kStyhTQhAhiOg,19469
         | 
| 13 | 
            -
            valetudo_map_parser/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 14 | 
            -
            valetudo_map_parser/rand25_handler.py,sha256=iGWxNgLzl-4btakBGKEbLqKOp7j2gDD6bmSAp4YGjkY,15317
         | 
| 15 | 
            -
            valetudo_map_parser/reimg_draw.py,sha256=dtdbYKKxmQnbOaHBHayWEF07OdSnTKo2CPSOW0qpgH0,12506
         | 
| 16 | 
            -
            valetudo_map_parser-0.1.9b22.dist-info/LICENSE,sha256=Lh-qBbuRV0-jiCIBhfV7NgdwFxQFOXH3BKOzK865hRs,10480
         | 
| 17 | 
            -
            valetudo_map_parser-0.1.9b22.dist-info/METADATA,sha256=B6EqNlL0I8Pmt-hy_nvT8HA9EdUTOb-_-X6dDAmowpo,1029
         | 
| 18 | 
            -
            valetudo_map_parser-0.1.9b22.dist-info/NOTICE.txt,sha256=5lTOuWiU9aiEnJ2go8sc7lTJ7ntMBx0g0GFnNrswCY4,2533
         | 
| 19 | 
            -
            valetudo_map_parser-0.1.9b22.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
         | 
| 20 | 
            -
            valetudo_map_parser-0.1.9b22.dist-info/RECORD,,
         | 
| 
            File without changes
         | 
    
        {valetudo_map_parser-0.1.9b22.dist-info → valetudo_map_parser-0.1.9b23.dist-info}/NOTICE.txt
    RENAMED
    
    | 
            File without changes
         | 
| 
            File without changes
         |