Fix DB typing

This commit is contained in:
Nicolas Mowen 2026-03-26 11:35:46 -06:00
parent c4f90a660d
commit 3febd2d671
2 changed files with 13 additions and 11 deletions

View File

@ -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:

View File

@ -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