Name an unknown circuit, layout or year with a 404 instead of a 500
The circuit and track routes walked circuits.json with chained lookups, so an unknown country, locality, circuit or layout, or a year no layout covers, raised and answered 500 (/circuits/photos.json among them). One lookup now names the first unknown part and the API answers it 404. numpy loads only where a script uses it, so the models, and this lookup's test, need the standard library alone. Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import List, Dict, Any
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
@dataclass
|
||||
class GeoJSONGeometry:
|
||||
@@ -18,6 +16,8 @@ class GeoJSONGeometry:
|
||||
|
||||
def find_longest_straight(self, window_size=5) -> (List[float], List[float]):
|
||||
"""Find the longest approximately straight section of the track, including wrap-around."""
|
||||
import numpy as np # only here: the models themselves load with the standard library (the service's tests)
|
||||
|
||||
max_distance = 0
|
||||
best_start_idx = 0
|
||||
n = len(self.coordinates)
|
||||
|
||||
Reference in New Issue
Block a user