mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-05 14:47:40 +03:00
Fix DB typing
This commit is contained in:
parent
c4f90a660d
commit
3febd2d671
@ -1,18 +1,21 @@
|
|||||||
import re
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from playhouse.sqliteq import SqliteQueueDatabase
|
from playhouse.sqliteq import SqliteQueueDatabase
|
||||||
|
|
||||||
|
|
||||||
class SqliteVecQueueDatabase(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
|
self.load_vec_extension: bool = load_vec_extension
|
||||||
# no extension necessary, sqlite will load correctly for each platform
|
# no extension necessary, sqlite will load correctly for each platform
|
||||||
self.sqlite_vec_path = "/usr/local/lib/vec0"
|
self.sqlite_vec_path = "/usr/local/lib/vec0"
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def _connect(self, *args, **kwargs) -> sqlite3.Connection:
|
def _connect(self, *args: Any, **kwargs: Any) -> sqlite3.Connection:
|
||||||
conn: sqlite3.Connection = super()._connect(*args, **kwargs)
|
conn: sqlite3.Connection = super()._connect(*args, **kwargs) # type: ignore[misc]
|
||||||
if self.load_vec_extension:
|
if self.load_vec_extension:
|
||||||
self._load_vec_extension(conn)
|
self._load_vec_extension(conn)
|
||||||
|
|
||||||
@ -27,7 +30,7 @@ class SqliteVecQueueDatabase(SqliteQueueDatabase):
|
|||||||
conn.enable_load_extension(False)
|
conn.enable_load_extension(False)
|
||||||
|
|
||||||
def _register_regexp(self, conn: sqlite3.Connection) -> None:
|
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:
|
if item is None:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -24,15 +24,18 @@ no_implicit_reexport = true
|
|||||||
[mypy-frigate.*]
|
[mypy-frigate.*]
|
||||||
ignore_errors = false
|
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.*]
|
[mypy-frigate.api.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-frigate.config.*]
|
[mypy-frigate.config.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[mypy-frigate.db.*]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-frigate.debug_replay]
|
[mypy-frigate.debug_replay]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
@ -60,9 +63,5 @@ ignore_errors = true
|
|||||||
[mypy-frigate.util.*]
|
[mypy-frigate.util.*]
|
||||||
ignore_errors = true
|
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.*]
|
[mypy-frigate.video.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user