mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-27 06:39:00 +03:00
fix mypy errors from types-peewee 4.0 (#24323)
types-peewee 4.0 types model fields precisely, so 17 `type: ignore` comments and 2 `cast(str, ...)` calls are no longer needed. Its stubs type `.namedtuples()` and `.dicts()` queries as returning model instances, so the review cleanup reads namedtuple fields by name and the storage usage query casts its dict rows. `start_time` is declared `DateTimeField` but stores unix timestamps, so two reads cast it like `debug_replay.py` already does. `Export` gets an annotation for the `export_case_id` attribute peewee adds at runtime.
This commit is contained in:
@@ -406,12 +406,12 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
tracked_obj.obj_data["sub_label"] = (sub_label, score)
|
||||
|
||||
if event:
|
||||
event.sub_label = sub_label # type: ignore[assignment]
|
||||
event.sub_label = sub_label
|
||||
data = event.data
|
||||
if sub_label is None:
|
||||
data["sub_label_score"] = None # type: ignore[index]
|
||||
data["sub_label_score"] = None
|
||||
elif score is not None:
|
||||
data["sub_label_score"] = score # type: ignore[index]
|
||||
data["sub_label_score"] = score
|
||||
event.data = data
|
||||
event.save()
|
||||
|
||||
@@ -440,7 +440,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
objects_list = []
|
||||
sub_labels = set()
|
||||
events = Event.select(Event.id, Event.label, Event.sub_label).where(
|
||||
Event.id.in_(detection_ids) # type: ignore[call-arg, misc]
|
||||
Event.id.in_(detection_ids)
|
||||
)
|
||||
for det_event in events:
|
||||
if det_event.sub_label:
|
||||
@@ -506,11 +506,11 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
|
||||
if event:
|
||||
data = event.data
|
||||
data[field_name] = field_value # type: ignore[index]
|
||||
data[field_name] = field_value
|
||||
if field_value is None:
|
||||
data[f"{field_name}_score"] = None # type: ignore[index]
|
||||
data[f"{field_name}_score"] = None
|
||||
elif score is not None:
|
||||
data[f"{field_name}_score"] = score # type: ignore[index]
|
||||
data[f"{field_name}_score"] = score
|
||||
event.data = data
|
||||
event.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user