Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m22s
Run linting on the backend code / Build (pull_request) Successful in 43s
Run testing on the backend code / Build (pull_request) Failing after 2m23s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 24s
18 lines
689 B
Python
18 lines
689 B
Python
"""Helper function to return only the major landmarks from a large list."""
|
|
from ..structs.landmark import Landmark
|
|
|
|
def take_most_important(landmarks: list[Landmark], n_important) -> list[Landmark]:
|
|
"""
|
|
Given a list of landmarks, return the n_important most important landmarks
|
|
Args:
|
|
landmarks: list[Landmark] - list of landmarks
|
|
n_important: int - number of most important landmarks to return
|
|
Returns:
|
|
list[Landmark] - list of the n_important most important landmarks
|
|
"""
|
|
|
|
# Sort landmarks by attractiveness (descending)
|
|
sorted_landmarks = sorted(landmarks, key=lambda x: x.attractiveness, reverse=True)
|
|
|
|
return sorted_landmarks[:n_important]
|