Partial fix for mypy issues

This commit is contained in:
Ian Renton
2026-09-20 20:42:16 +01:00
parent 93ea27510f
commit 203758fa2d
25 changed files with 244 additions and 147 deletions
+5 -2
View File
@@ -106,13 +106,14 @@ class V1APISpotHandler(tornado.web.RequestHandler):
return
# Reject if activity ref format incorrect for activity
ref_regex = get_ref_regex_for_activity(spot.sig) if spot.sig else None
if (
spot.sig
and spot.sig_refs
and len(spot.sig_refs) > 0
and spot.sig_refs[0].id
and get_ref_regex_for_activity(spot.sig)
and not re.match(get_ref_regex_for_activity(spot.sig), spot.sig_refs[0].id)
and ref_regex
and not re.match(ref_regex, spot.sig_refs[0].id)
):
self.set_status(422)
self.write(
@@ -127,6 +128,8 @@ class V1APISpotHandler(tornado.web.RequestHandler):
# infer missing data, and add it to our database.
spot.source = "API"
spot.infer_missing()
assert self._spots is not None, "initialize() must be called before post()"
assert spot.id is not None, "infer_missing() always assigns an id"
self._spots.set(spot.id, spot)
self.write(safe_json_dumps("OK"))