[fix] Corrections ruff CI (UP017/UP041/UP012/I001/F401/FURB162) : backend/indexer.py

This commit is contained in:
2026-10-27 22:57:36 -04:00
parent 97132770e4
commit 7af7b2c8c2
+4 -4
View File
@@ -5,7 +5,7 @@ import os
import re import re
import threading import threading
from collections.abc import Callable from collections.abc import Callable
from datetime import datetime, timezone from datetime import UTC, datetime
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
@@ -581,7 +581,7 @@ def _scan_vault(
try: try:
relative = fpath.relative_to(vault_root) relative = fpath.relative_to(vault_root)
stat = fpath.stat() stat = fpath.stat()
modified = datetime.fromtimestamp(stat.st_mtime, tz=timezone.utc).isoformat() modified = datetime.fromtimestamp(stat.st_mtime, tz=UTC).isoformat()
# #86 differential scan: reuse the previous entry when neither # #86 differential scan: reuse the previous entry when neither
# size nor mtime changed — skips the disk read + parse below. # size nor mtime changed — skips the disk read + parse below.
@@ -866,7 +866,7 @@ async def build_index(progress_callback=None) -> None:
# Record timestamp of full index rebuild # Record timestamp of full index rebuild
global _last_full_index_ts global _last_full_index_ts
_last_full_index_ts = datetime.now(timezone.utc).isoformat() _last_full_index_ts = datetime.now(UTC).isoformat()
# Build attachment index # Build attachment index
from backend.attachment_indexer import build_attachment_index from backend.attachment_indexer import build_attachment_index
@@ -1033,7 +1033,7 @@ def _index_single_file_sync(vault_name: str, vault_path: str, file_path: str, va
return None return None
stat = fpath.stat() stat = fpath.stat()
modified = datetime.fromtimestamp(stat.st_mtime, tz=timezone.utc).isoformat() modified = datetime.fromtimestamp(stat.st_mtime, tz=UTC).isoformat()
# PDF handling — binary, must go through pdf_reader (same as _scan_vault) # PDF handling — binary, must go through pdf_reader (same as _scan_vault)
tags: list[str] = [] tags: list[str] = []