From 3febd2d67114d1e65960f29d03d4e3218ad7c458 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 26 Mar 2026 11:35:46 -0600 Subject: [PATCH] Fix DB typing --- frigate/db/sqlitevecq.py | 11 +++++++---- frigate/mypy.ini | 13 ++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/frigate/db/sqlitevecq.py b/frigate/db/sqlitevecq.py index aa4928e84..a72e99b6a 100644 --- a/frigate/db/sqlitevecq.py +++ b/frigate/db/sqlitevecq.py @@ -1,18 +1,21 @@ import re import sqlite3 +from typing import Any from playhouse.sqliteq import SqliteQueueDatabase class SqliteVecQueueDatabase(SqliteQueueDatabase): - def __init__(self, *args, load_vec_extension: bool = False, **kwargs) -> None: + def __init__( + self, *args: Any, load_vec_extension: bool = False, **kwargs: Any + ) -> None: self.load_vec_extension: bool = load_vec_extension # no extension necessary, sqlite will load correctly for each platform self.sqlite_vec_path = "/usr/local/lib/vec0" super().__init__(*args, **kwargs) - def _connect(self, *args, **kwargs) -> sqlite3.Connection: - conn: sqlite3.Connection = super()._connect(*args, **kwargs) + def _connect(self, *args: Any, **kwargs: Any) -> sqlite3.Connection: + conn: sqlite3.Connection = super()._connect(*args, **kwargs) # type: ignore[misc] if self.load_vec_extension: self._load_vec_extension(conn) @@ -27,7 +30,7 @@ class SqliteVecQueueDatabase(SqliteQueueDatabase): conn.enable_load_extension(False) def _register_regexp(self, conn: sqlite3.Connection) -> None: - def regexp(expr: str, item: str) -> bool: + def regexp(expr: str, item: str | None) -> bool: if item is None: return False try: diff --git a/frigate/mypy.ini b/frigate/mypy.ini index 68f8f6e75..78c156c38 100644 --- a/frigate/mypy.ini +++ b/frigate/mypy.ini @@ -24,15 +24,18 @@ no_implicit_reexport = true [mypy-frigate.*] ignore_errors = false +# Third-party code imported from https://github.com/ufal/whisper_streaming +[mypy-frigate.data_processing.real_time.whisper_online] +ignore_errors = true + +# TODO: Remove ignores for these modules as they are updated with type annotations. + [mypy-frigate.api.*] ignore_errors = true [mypy-frigate.config.*] ignore_errors = true -[mypy-frigate.db.*] -ignore_errors = true - [mypy-frigate.debug_replay] ignore_errors = true @@ -60,9 +63,5 @@ ignore_errors = true [mypy-frigate.util.*] ignore_errors = true -# Third-party code imported from https://github.com/ufal/whisper_streaming -[mypy-frigate.data_processing.real_time.whisper_online] -ignore_errors = true - [mypy-frigate.video.*] ignore_errors = true