From dcc9b6ebb1e61933de8d442fef4832cbf38a8533 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 25 Mar 2026 15:00:16 -0600 Subject: [PATCH] Improve review mypy --- frigate/mypy.ini | 3 +++ frigate/record/cleanup.py | 2 +- frigate/review/maintainer.py | 14 +++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/frigate/mypy.ini b/frigate/mypy.ini index de396a381..a41271460 100644 --- a/frigate/mypy.ini +++ b/frigate/mypy.ini @@ -71,6 +71,9 @@ ignore_errors = false [mypy-frigate.record.*] ignore_errors = false +[mypy-frigate.review.*] +ignore_errors = false + [mypy-frigate.service_manager.*] ignore_errors = false diff --git a/frigate/record/cleanup.py b/frigate/record/cleanup.py index c306f86bf..e41a5bf39 100644 --- a/frigate/record/cleanup.py +++ b/frigate/record/cleanup.py @@ -298,7 +298,7 @@ class RecordingCleanup(threading.Thread): Recordings.path, ) .where( - Recordings.camera.not_in(list(self.config.cameras.keys())), # type: ignore[call-arg, arg-type] + Recordings.camera.not_in(list(self.config.cameras.keys())), # type: ignore[call-arg, arg-type, misc] Recordings.end_time < expire_before, ) .namedtuples() diff --git a/frigate/review/maintainer.py b/frigate/review/maintainer.py index 4dc1d8e6a..3faf8a99b 100644 --- a/frigate/review/maintainer.py +++ b/frigate/review/maintainer.py @@ -31,7 +31,7 @@ from frigate.const import ( ) from frigate.models import ReviewSegment from frigate.review.types import SeverityEnum -from frigate.track.object_processing import ManualEventState, TrackedObject +from frigate.track.object_processing import ManualEventState from frigate.util.image import SharedMemoryFrameManager, calculate_16_9_crop logger = logging.getLogger(__name__) @@ -77,7 +77,7 @@ class PendingReviewSegment: ) def update_frame( - self, camera_config: CameraConfig, frame, objects: list[TrackedObject] + self, camera_config: CameraConfig, frame, objects: list[dict[str, Any]] ): min_x = camera_config.frame_shape[1] min_y = camera_config.frame_shape[0] @@ -165,7 +165,7 @@ class ActiveObjects: self, frame_time: float, camera_config: CameraConfig, - all_objects: list[TrackedObject], + all_objects: list[dict[str, Any]], ): self.camera_config = camera_config @@ -250,7 +250,7 @@ class ActiveObjects: return False - def get_all_objects(self) -> list[TrackedObject]: + def get_all_objects(self) -> list[dict[str, Any]]: return ( self.categorized_objects["alerts"] + self.categorized_objects["detections"] ) @@ -319,7 +319,7 @@ class ReviewSegmentMaintainer(threading.Thread): segment: PendingReviewSegment, camera_config: CameraConfig, frame, - objects: list[TrackedObject], + objects: list[dict[str, Any]], prev_data: dict[str, Any], ) -> None: """Update segment.""" @@ -377,7 +377,7 @@ class ReviewSegmentMaintainer(threading.Thread): segment: PendingReviewSegment, frame_name: str, frame_time: float, - objects: list[TrackedObject], + objects: list[dict[str, Any]], ) -> None: """Validate if existing review segment should continue.""" camera_config = self.config.cameras[segment.camera] @@ -544,7 +544,7 @@ class ReviewSegmentMaintainer(threading.Thread): camera: str, frame_name: str, frame_time: float, - objects: list[TrackedObject], + objects: list[dict[str, Any]], ) -> None: """Check if a new review segment should be created.""" camera_config = self.config.cameras[camera]