valetudo-map-parser 0.1.9b34__py3-none-any.whl → 0.1.9b35__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/config/auto_crop.py +3 -1
- valetudo_map_parser/config/shared.py +3 -1
- valetudo_map_parser/config/types.py +35 -21
- valetudo_map_parser/hypfer_handler.py +3 -1
- valetudo_map_parser/rand25_handler.py +1 -1
- {valetudo_map_parser-0.1.9b34.dist-info → valetudo_map_parser-0.1.9b35.dist-info}/METADATA +1 -1
- {valetudo_map_parser-0.1.9b34.dist-info → valetudo_map_parser-0.1.9b35.dist-info}/RECORD +10 -10
- {valetudo_map_parser-0.1.9b34.dist-info → valetudo_map_parser-0.1.9b35.dist-info}/LICENSE +0 -0
- {valetudo_map_parser-0.1.9b34.dist-info → valetudo_map_parser-0.1.9b35.dist-info}/NOTICE.txt +0 -0
- {valetudo_map_parser-0.1.9b34.dist-info → valetudo_map_parser-0.1.9b35.dist-info}/WHEEL +0 -0
@@ -118,7 +118,9 @@ class AutoCrop:
|
|
118
118
|
async def _init_auto_crop(self):
|
119
119
|
"""Initialize the auto crop data."""
|
120
120
|
_LOGGER.debug("Auto Crop Init data: %s", str(self.auto_crop))
|
121
|
-
_LOGGER.debug(
|
121
|
+
_LOGGER.debug(
|
122
|
+
"Auto Crop Init trims data: %s", self.handler.shared.trims.to_dict()
|
123
|
+
)
|
122
124
|
if not self.auto_crop: # and self.handler.shared.vacuum_state == "docked":
|
123
125
|
self.auto_crop = await self._async_auto_crop_data(self.handler.shared.trims)
|
124
126
|
if self.auto_crop:
|
@@ -237,7 +237,9 @@ class CameraSharedManager:
|
|
237
237
|
_LOGGER.debug("Updating shared trims with: %s", trim_data)
|
238
238
|
instance.trims = TrimsData.from_dict(trim_data)
|
239
239
|
|
240
|
-
_LOGGER.debug(
|
240
|
+
_LOGGER.debug(
|
241
|
+
"Shared trims successfully updated: %s", instance.trims.to_dict()
|
242
|
+
)
|
241
243
|
|
242
244
|
except TypeError as ex:
|
243
245
|
_LOGGER.error("Shared data can't be initialized due to a TypeError! %s", ex)
|
@@ -6,8 +6,9 @@ Version 0.0.1
|
|
6
6
|
import asyncio
|
7
7
|
import json
|
8
8
|
import logging
|
9
|
+
import threading
|
9
10
|
from dataclasses import asdict, dataclass
|
10
|
-
from typing import Any, Dict, Tuple, Union
|
11
|
+
from typing import Any, Dict, Optional, Tuple, Union
|
11
12
|
|
12
13
|
import numpy as np
|
13
14
|
from PIL import Image
|
@@ -75,44 +76,57 @@ class TrimCropData:
|
|
75
76
|
|
76
77
|
|
77
78
|
class RoomStore:
|
78
|
-
"""
|
79
|
+
"""
|
80
|
+
Singleton RoomStore per vacuum_id.
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
+
This class stores room data (a dictionary) for each vacuum.
|
83
|
+
Calling RoomStore(vacuum_id, rooms_data) creates a new instance for that vacuum_id if it doesn't exist,
|
84
|
+
or returns the existing one (optionally updating the data if rooms_data is provided).
|
85
|
+
"""
|
86
|
+
|
87
|
+
_instances: Dict[str, "RoomStore"] = {}
|
88
|
+
_lock = threading.Lock()
|
89
|
+
|
90
|
+
# Declare instance attributes for static analysis tools like Pylint
|
91
|
+
vacuum_id: str
|
92
|
+
vacuums_data: dict
|
82
93
|
|
83
94
|
def __new__(cls, vacuum_id: str, rooms_data: Optional[dict] = None) -> "RoomStore":
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
95
|
+
with cls._lock:
|
96
|
+
if vacuum_id not in cls._instances:
|
97
|
+
instance = super(RoomStore, cls).__new__(cls)
|
98
|
+
instance.vacuum_id = vacuum_id
|
99
|
+
instance.vacuums_data = rooms_data or {}
|
100
|
+
cls._instances[vacuum_id] = instance
|
101
|
+
else:
|
102
|
+
# Update the instance's data if new rooms_data is provided.
|
103
|
+
if rooms_data is not None:
|
104
|
+
cls._instances[vacuum_id].vacuums_data = rooms_data
|
90
105
|
return cls._instances[vacuum_id]
|
91
106
|
|
92
|
-
def __init__(self, vacuum_id: str, rooms_data: Optional[dict] = None):
|
93
|
-
"""Initialize the instance."""
|
94
|
-
self.vacuum_id = vacuum_id
|
95
|
-
self.vacuums_data = rooms_data or {}
|
96
|
-
|
97
107
|
def get_rooms(self) -> dict:
|
98
108
|
"""Return the stored rooms data."""
|
99
109
|
return self.vacuums_data
|
100
110
|
|
101
111
|
def set_rooms(self, rooms_data: dict) -> None:
|
102
|
-
"""Update the rooms data."""
|
112
|
+
"""Update the stored rooms data."""
|
103
113
|
self.vacuums_data = rooms_data
|
104
114
|
|
105
115
|
def get_rooms_count(self) -> int:
|
106
|
-
"""
|
107
|
-
|
116
|
+
"""
|
117
|
+
Return the number of rooms stored for this vacuum.
|
118
|
+
This is simply the number of keys in the vacuums_data dictionary.
|
119
|
+
"""
|
120
|
+
if isinstance(self.vacuums_data, dict):
|
121
|
+
return len(self.vacuums_data)
|
122
|
+
return DEFAULT_ROOMS
|
108
123
|
|
109
124
|
@classmethod
|
110
125
|
def get_all_instances(cls) -> Dict[str, "RoomStore"]:
|
111
|
-
"""Return all active instances (for debugging)."""
|
126
|
+
"""Return all active RoomStore instances (useful for debugging)."""
|
112
127
|
return cls._instances
|
113
128
|
|
114
129
|
|
115
|
-
|
116
130
|
# pylint: disable=no-member
|
117
131
|
class UserLanguageStore:
|
118
132
|
"""Store the user language data."""
|
@@ -625,7 +639,7 @@ class TrimsData:
|
|
625
639
|
"""Convert TrimData to a dictionary."""
|
626
640
|
return asdict(self)
|
627
641
|
|
628
|
-
def clear(self)-> dict:
|
642
|
+
def clear(self) -> dict:
|
629
643
|
"""Clear all the trims."""
|
630
644
|
self.trim_left = 0
|
631
645
|
self.trim_up = 0
|
@@ -84,7 +84,9 @@ class HypferMapImageHandler(BaseHandler, AutoCrop):
|
|
84
84
|
}
|
85
85
|
if room_properties:
|
86
86
|
rooms = RoomStore(self.file_name, room_properties)
|
87
|
-
_LOGGER.debug(
|
87
|
+
_LOGGER.debug(
|
88
|
+
"%s: Rooms data extracted! %s", self.file_name, rooms.get_rooms()
|
89
|
+
)
|
88
90
|
else:
|
89
91
|
_LOGGER.debug("%s: Rooms data not available!", self.file_name)
|
90
92
|
self.rooms_pos = None
|
@@ -23,11 +23,11 @@ from .config.types import (
|
|
23
23
|
PilPNG,
|
24
24
|
RobotPosition,
|
25
25
|
RoomsProperties,
|
26
|
+
RoomStore,
|
26
27
|
)
|
27
28
|
from .config.utils import BaseHandler, prepare_resize_params
|
28
29
|
from .map_data import RandImageData
|
29
30
|
from .reimg_draw import ImageDraw
|
30
|
-
from .config.types import RoomStore
|
31
31
|
|
32
32
|
|
33
33
|
_LOGGER = logging.getLogger(__name__)
|
@@ -1,21 +1,21 @@
|
|
1
1
|
valetudo_map_parser/__init__.py,sha256=Wmd20bdI1btzMq-0x8NxGYWskTjdUmD-Fem9MTfziwU,810
|
2
2
|
valetudo_map_parser/config/__init__.py,sha256=DQ9plV3ZF_K25Dp5ZQHPDoG-40dQoJNdNi-dfNeR3Zc,48
|
3
|
-
valetudo_map_parser/config/auto_crop.py,sha256=
|
3
|
+
valetudo_map_parser/config/auto_crop.py,sha256=gYTSp4XkBTY2ir7wizBqSWdfwoZJV6Rjs5wwGw9N-pY,12494
|
4
4
|
valetudo_map_parser/config/colors.py,sha256=IzTT9JvF12YGGJxaTiEJRuwUdCCsFCLzsR9seCDfYWs,6515
|
5
5
|
valetudo_map_parser/config/colors_man.py,sha256=9b5c6XmpMzhEiunwfIjVkOk1lDyV-UFoasACdkGXfbo,7833
|
6
6
|
valetudo_map_parser/config/drawable.py,sha256=hsrEJCMVOrjs5sJfr26SeqJD0VNlYWwxcVkkHeaxx7U,20356
|
7
7
|
valetudo_map_parser/config/rand25_parser.py,sha256=kIayyqVZBfQfAMkiArzqrrj9vqZB3pkgT0Y5ufrQmGA,16448
|
8
|
-
valetudo_map_parser/config/shared.py,sha256=
|
9
|
-
valetudo_map_parser/config/types.py,sha256=
|
8
|
+
valetudo_map_parser/config/shared.py,sha256=tZrUDVZ5acyKPuyyp9Zca95SbZfR1Rz2hRAcIEu2LoU,10149
|
9
|
+
valetudo_map_parser/config/types.py,sha256=L-7Jhx-nmT6iIP3g4vMt6xmjqF-HTj2ygix_gBLRg5Y,18018
|
10
10
|
valetudo_map_parser/config/utils.py,sha256=yPutV-FEQlDB2z3LhOOFznoprHCApF-zrQMiOtkcO-k,19198
|
11
11
|
valetudo_map_parser/hypfer_draw.py,sha256=1trtil-CQcDSiAMBWPBmuP5L9MWHGTp5OlY7MX8FgDg,14932
|
12
|
-
valetudo_map_parser/hypfer_handler.py,sha256=
|
12
|
+
valetudo_map_parser/hypfer_handler.py,sha256=f_1oG69BA94sjcZ8O9Y6A1H-YyEutbvERzqnwgremvg,13001
|
13
13
|
valetudo_map_parser/map_data.py,sha256=6FbQfgxFB6E4kcOWokReJOVSekVaE1kStyhTQhAhiOg,19469
|
14
14
|
valetudo_map_parser/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
valetudo_map_parser/rand25_handler.py,sha256=
|
15
|
+
valetudo_map_parser/rand25_handler.py,sha256=GxZ8UDUYEXlQme-m29HZEIstBQL3zDJr5DOsgqBolUk,15235
|
16
16
|
valetudo_map_parser/reimg_draw.py,sha256=V0JUASavKVnEtAhv7nOV4pjsRxZrNsjIUtctbKO8wvk,12507
|
17
|
-
valetudo_map_parser-0.1.
|
18
|
-
valetudo_map_parser-0.1.
|
19
|
-
valetudo_map_parser-0.1.
|
20
|
-
valetudo_map_parser-0.1.
|
21
|
-
valetudo_map_parser-0.1.
|
17
|
+
valetudo_map_parser-0.1.9b35.dist-info/LICENSE,sha256=Lh-qBbuRV0-jiCIBhfV7NgdwFxQFOXH3BKOzK865hRs,10480
|
18
|
+
valetudo_map_parser-0.1.9b35.dist-info/METADATA,sha256=-Sa1QB1XL__hYvO9p65-pDxwgO58MihhsR7sAGebkFU,1029
|
19
|
+
valetudo_map_parser-0.1.9b35.dist-info/NOTICE.txt,sha256=5lTOuWiU9aiEnJ2go8sc7lTJ7ntMBx0g0GFnNrswCY4,2533
|
20
|
+
valetudo_map_parser-0.1.9b35.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
21
|
+
valetudo_map_parser-0.1.9b35.dist-info/RECORD,,
|
File without changes
|
{valetudo_map_parser-0.1.9b34.dist-info → valetudo_map_parser-0.1.9b35.dist-info}/NOTICE.txt
RENAMED
File without changes
|
File without changes
|