[P] Code cleanup.

This commit is contained in:
2026-03-27 13:57:02 +01:00
parent 91dc8b284d
commit f1d198741e
2 changed files with 8 additions and 8 deletions

View File

@@ -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

View File

@@ -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)