fix: resolve all 28 mypy type errors + re-enable coverage in CI
CI / lint (push) Successful in 11s
CI / security (push) Successful in 7s
CI / test (push) Successful in 13s
CI / build (push) Successful in 1s

This commit is contained in:
2026-05-28 12:57:30 -04:00
parent 7096050da5
commit 1a14927f36
8 changed files with 29 additions and 27 deletions
+5 -5
View File
@@ -5,7 +5,7 @@ import re
import threading
from pathlib import Path
from datetime import datetime, timezone
from typing import Dict, List, Optional, Any
from typing import Any, Callable, Dict, List, Optional
import frontmatter
@@ -21,14 +21,14 @@ vault_config: Dict[str, Dict[str, Any]] = {}
_index_lock = threading.Lock()
# Async lock for partial index updates (coexists with threading lock)
_async_index_lock: asyncio.Lock = None # initialized lazily
_async_index_lock: asyncio.Lock | None = None # initialized lazily
# Generation counter — incremented on each index rebuild so consumers
# (e.g. the inverted index in search.py) can detect staleness.
_index_generation: int = 0
# Hook for incremental inverted index updates: called as (action, vault, path, file_info)
_on_index_change: callable = None
_on_index_change: Callable[..., None] | None = None
def set_index_change_hook(hook):
@@ -615,7 +615,7 @@ def _remove_file_from_structures(vault_name: str, rel_path: str) -> Optional[Dic
# Notify inverted index for incremental update
if _on_index_change:
_on_index_change('remove', vault_name, rel_path, removed)
_on_index_change('remove', vault_name, rel_path, removed) # type: ignore[misc]
return removed
@@ -686,7 +686,7 @@ def _add_file_to_structures(vault_name: str, file_info: Dict[str, Any]):
# Notify inverted index for incremental update
if _on_index_change:
_on_index_change('add', vault_name, file_info["path"], file_info)
_on_index_change('add', vault_name, file_info["path"], file_info) # type: ignore[misc]
async def update_single_file(vault_name: str, abs_file_path: str) -> Optional[Dict[str, Any]]: