linting
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Has been cancelled
Build and deploy the backend to staging / Deploy to staging (pull_request) Has been cancelled
Run testing on the backend code / Build (pull_request) Has been cancelled
Run linting on the backend code / Build (pull_request) Successful in 28s

This commit is contained in:
2025-02-19 14:51:38 +01:00
parent 8a9ec6b4d8
commit 83be4b7616
6 changed files with 29 additions and 31 deletions

View File

@@ -250,19 +250,17 @@ class ClusterManager:
continue
for elem in result:
osm_type = elem.get('type')
id, coords, name = get_base_info(elem, osm_type, with_name=True)
# Get basic info
id, coords, name = get_base_info(elem, elem.get('type'), with_name=True)
if name is None or coords is None :
continue
d = get_distance(cluster.centroid, coords)
if d < min_dist :
min_dist = d
new_name = name # add name
osm_type = osm_type # add type: 'way' or 'relation'
osm_id = id # add OSM id
new_name = name # add name
osm_type = elem.get('type') # add type: 'way' or 'relation'
osm_id = id # add OSM id
return Landmark(
name=new_name,

View File

@@ -197,7 +197,7 @@ class LandmarkManager:
out = 'ids center tags'
)
except Exception as e:
self.logger.error(f"Error fetching landmarks: {e}")
self.logger.error(f"Error fetching landmarks: {str(e)}")
continue
return_list += self._to_landmarks(result, landmarktype, preference_level)
@@ -294,9 +294,11 @@ class LandmarkManager:
return landmarks
def description_and_keywords(self, tags: dict):
"""
"""
# Extract relevant fields
name = tags.get('name')
importance = tags.get('importance', None)
@@ -314,7 +316,6 @@ class LandmarkManager:
return None, None
elif len(tags.keys()) < 10 :
description = f"{name} is a well known {place_type}."
elif len(tags.keys()) < 17 :
importance = 'national'
description = f"{name} is a {place_type} of national importance."
@@ -328,9 +329,9 @@ class LandmarkManager:
description += f" This {place_type} was constructed in {date} and is ca. {height} meters high."
elif height is not None :
description += f" This {place_type} stands ca. {height} meters tall."
elif date is not None:
elif date is not None:
description += f" It was constructed in {date}."
# Format the visitor number
if n_visitors is not None :
n_visitors = int(n_visitors)
@@ -385,8 +386,6 @@ class LandmarkManager:
return None
def dict_to_selector_list(d: dict) -> list:
"""
@@ -408,5 +407,3 @@ def dict_to_selector_list(d: dict) -> list:
else:
return_list.append(f'{key}={value}')
return return_list