From f1d198741ed434c3718aaa02047d9c15a865c24c Mon Sep 17 00:00:00 2001 From: rhinemann Date: Fri, 27 Mar 2026 13:57:02 +0100 Subject: [PATCH] [P] Code cleanup. --- MapView/datasource.py | 5 +++-- MapView/main.py | 11 +++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MapView/datasource.py b/MapView/datasource.py index 28c59c9..6b1c623 100644 --- a/MapView/datasource.py +++ b/MapView/datasource.py @@ -61,8 +61,9 @@ class Datasource: self.connection_status = "Disconnected" Logger.debug("SERVER DISCONNECT") - def map_lat_lon_to_ProcessedAgentData(self, lat: float, lon: float) -> ProcessedAgentData | None: - distances = tuple((abs(lon - marker.latitude) ** 2 + abs(lat - marker.longitude) ** 2) ** 0.5 for marker in self._active_markers) + def map_lat_lon_to_processed_agent_data(self, lat: float, lon: float) -> ProcessedAgentData | None: + distances = tuple((abs(lon - marker.latitude) ** 2 + abs(lat - marker.longitude) ** 2) ** 0.5 for marker in + self._active_markers) if len(distances) == 0: return None diff --git a/MapView/main.py b/MapView/main.py index 6dcece2..1403b4c 100644 --- a/MapView/main.py +++ b/MapView/main.py @@ -63,7 +63,7 @@ class MapViewApp(App): # Оновлює лінію маршрута if user_id not in self.line_layers: - self.line_layers[user_id] = LineMapLayer(color = line_layer_colors[user_id % len(line_layer_colors)]) + self.line_layers[user_id] = LineMapLayer(color=line_layer_colors[user_id % len(line_layer_colors)]) self.mapview.add_layer(self.line_layers[user_id]) self.line_layers[user_id].add_point((lat, lon)) @@ -109,7 +109,7 @@ class MapViewApp(App): try: return next(flt) - except StopIteration as e: + except StopIteration: return None def set_pothole_marker(self, point): @@ -145,14 +145,14 @@ class MapViewApp(App): if lat is None or lon is None: return - clicked_marker_data = self.datasource.map_lat_lon_to_ProcessedAgentData(lat, lon) + clicked_marker_data = self.datasource.map_lat_lon_to_processed_agent_data(lat, lon) if not clicked_marker_data: return clicked_marker = self.map_lat_lon_to_marker(clicked_marker_data.latitude, clicked_marker_data.longitude) - if clicked_marker == None: + if clicked_marker is None: return self.mapview.remove_marker(clicked_marker) @@ -168,7 +168,6 @@ class MapViewApp(App): self.delete_pothole_marker(coordinate) return True - def build(self): """ Ініціалізує мапу MapView(zoom, lat, lon) @@ -180,7 +179,7 @@ class MapViewApp(App): lon=30.5234 ) - self.mapview.bind(on_touch_down = self.on_touch_down) + self.mapview.bind(on_touch_down=self.on_touch_down) return self.mapview