]> git.openstreetmap.org Git - nominatim.git/commitdiff
prefer min() function over if construct
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 27 Feb 2024 08:26:50 +0000 (09:26 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Tue, 27 Feb 2024 08:26:50 +0000 (09:26 +0100)
Fixes a linter complaint.

nominatim/api/search/db_search_fields.py

index 6947a565f80dad421dcd9398975284988121a254..846e1ce28dc4589969d0c25942fbb025741daa73 100644 (file)
@@ -199,8 +199,7 @@ class SearchData:
             categories: Dict[Tuple[str, str], float] = {}
             min_penalty = 1000.0
             for t in tokens:
-                if t.penalty < min_penalty:
-                    min_penalty = t.penalty
+                min_penalty = min(min_penalty, t.penalty)
                 cat = t.get_category()
                 if t.penalty < categories.get(cat, 1000.0):
                     categories[cat] = t.penalty