Cleanup timeline mypy

This commit is contained in:
Nicolas Mowen 2026-03-25 13:20:30 -06:00
parent 7e2f5b98d5
commit 3f04b98e93
2 changed files with 13 additions and 6 deletions

View File

@ -74,6 +74,9 @@ ignore_errors = false
[mypy-frigate.storage] [mypy-frigate.storage]
ignore_errors = false ignore_errors = false
[mypy-frigate.timeline]
ignore_errors = false
[mypy-frigate.track.*] [mypy-frigate.track.*]
ignore_errors = false ignore_errors = false

View File

@ -8,7 +8,7 @@ from multiprocessing.synchronize import Event as MpEvent
from typing import Any from typing import Any
from frigate.config import FrigateConfig from frigate.config import FrigateConfig
from frigate.events.maintainer import EventStateEnum, EventTypeEnum from frigate.events.types import EventStateEnum, EventTypeEnum
from frigate.models import Timeline from frigate.models import Timeline
from frigate.util.builtin import to_relative_box from frigate.util.builtin import to_relative_box
@ -28,7 +28,7 @@ class TimelineProcessor(threading.Thread):
self.config = config self.config = config
self.queue = queue self.queue = queue
self.stop_event = stop_event self.stop_event = stop_event
self.pre_event_cache: dict[str, list[dict[str, Any]]] = {} self.pre_event_cache: dict[str, list[dict[Any, Any]]] = {}
def run(self) -> None: def run(self) -> None:
while not self.stop_event.is_set(): while not self.stop_event.is_set():
@ -56,7 +56,7 @@ class TimelineProcessor(threading.Thread):
def insert_or_save( def insert_or_save(
self, self,
entry: dict[str, Any], entry: dict[Any, Any],
prev_event_data: dict[Any, Any], prev_event_data: dict[Any, Any],
event_data: dict[Any, Any], event_data: dict[Any, Any],
) -> None: ) -> None:
@ -84,11 +84,15 @@ class TimelineProcessor(threading.Thread):
event_type: str, event_type: str,
prev_event_data: dict[Any, Any], prev_event_data: dict[Any, Any],
event_data: dict[Any, Any], event_data: dict[Any, Any],
) -> bool: ) -> None:
"""Handle object detection.""" """Handle object detection."""
camera_config = self.config.cameras.get(camera) camera_config = self.config.cameras.get(camera)
if camera_config is None: if (
return False camera_config is None
or camera_config.detect.width is None
or camera_config.detect.height is None
):
return
event_id = event_data["id"] event_id = event_data["id"]
# Base timeline entry data that all entries will share # Base timeline entry data that all entries will share