mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-29 09:54:41 +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:
@@ -8,7 +8,7 @@ import os
|
||||
import shutil
|
||||
import threading
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
import cv2
|
||||
from peewee import DoesNotExist
|
||||
@@ -528,7 +528,8 @@ class ReviewDescriptionProcessor(PostProcessorApi):
|
||||
.get()
|
||||
)
|
||||
|
||||
time_in_segment = ts - recording.start_time
|
||||
# start_time is a DateTimeField holding a unix timestamp
|
||||
time_in_segment = ts - cast(float, recording.start_time)
|
||||
return get_image_from_recording(
|
||||
self.config.ffmpeg,
|
||||
recording.path,
|
||||
|
||||
Reference in New Issue
Block a user