chore: linting

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-06-09 00:42:26 -07:00
parent 0a012dbc79
commit ce952d2ad1
127 changed files with 821 additions and 517 deletions

View file

@ -9,8 +9,8 @@ from uuid import UUID
from app.celery_app import celery_app
from app.config import config
from app.observability import metrics as ot_metrics
from app.notifications.service import NotificationService
from app.observability import metrics as ot_metrics
from app.services.task_logging_service import TaskLoggingService
from app.tasks.celery_tasks import get_celery_session_maker, run_async_celery_task
from app.tasks.connector_indexers.local_folder_indexer import (
@ -1335,7 +1335,7 @@ async def _index_local_folder_async(
exclude_patterns=exclude_patterns,
file_extensions=file_extensions,
root_folder_id=root_folder_id,
target_file_paths=target_file_paths,
target_file_paths=target_file_paths,
on_heartbeat_callback=_heartbeat_progress
if (is_batch or is_full_scan)
else None,
@ -1463,7 +1463,7 @@ async def _index_uploaded_folder_files_async(
user_id=user_id,
folder_name=folder_name,
root_folder_id=root_folder_id,
file_mappings=file_mappings,
file_mappings=file_mappings,
on_heartbeat_callback=_heartbeat_progress,
use_vision_llm=use_vision_llm,
processing_mode=processing_mode,

View file

@ -46,7 +46,8 @@ def reconcile_inbox_task() -> None:
result = await session.execute(
update(ExternalChatInboundEvent)
.where(
ExternalChatInboundEvent.status == ExternalChatEventStatus.PROCESSING,
ExternalChatInboundEvent.status
== ExternalChatEventStatus.PROCESSING,
ExternalChatInboundEvent.received_at < stale_threshold,
)
.values(
@ -163,4 +164,3 @@ async def enqueue_telegram_update(account_id: int, raw_update: dict) -> int | No
)
await session.commit()
return inbox_id

View file

@ -260,7 +260,7 @@ async def index_confluence_pages(
connector_id=connector_id,
search_space_id=search_space_id,
user_id=user_id,
)
)
with session.no_autoflush:
duplicate_by_content = await check_duplicate_document_by_hash(

View file

@ -414,7 +414,7 @@ async def index_google_calendar_events(
connector_id=connector_id,
search_space_id=search_space_id,
user_id=user_id,
)
)
with session.no_autoflush:
duplicate = await check_duplicate_document_by_hash(

View file

@ -552,7 +552,7 @@ async def _process_single_file(
connector_id=connector_id,
search_space_id=search_space_id,
user_id=user_id,
)
)
pipeline = IndexingPipelineService(session)
documents = await pipeline.prepare_for_indexing([doc])

View file

@ -444,7 +444,7 @@ async def index_google_gmail_messages(
connector_id=connector_id,
search_space_id=search_space_id,
user_id=user_id,
)
)
with session.no_autoflush:
duplicate = await check_duplicate_document_by_hash(

View file

@ -268,7 +268,7 @@ async def index_linear_issues(
connector_id=connector_id,
search_space_id=search_space_id,
user_id=user_id,
)
)
with session.no_autoflush:
duplicate = await check_duplicate_document_by_hash(

View file

@ -568,7 +568,7 @@ async def index_local_folder(
folder_path=folder_path,
folder_name=folder_name,
target_file_path=target_file_paths[0],
root_folder_id=root_folder_id,
root_folder_id=root_folder_id,
task_logger=task_logger,
log_entry=log_entry,
)
@ -580,7 +580,7 @@ async def index_local_folder(
folder_path=folder_path,
folder_name=folder_name,
target_file_paths=target_file_paths,
root_folder_id=root_folder_id,
root_folder_id=root_folder_id,
on_progress_callback=on_heartbeat_callback,
)
if err:
@ -766,7 +766,7 @@ async def index_local_folder(
folder_name=folder_name,
search_space_id=search_space_id,
user_id=user_id,
)
)
connector_docs.append(doc)
file_meta_map[unique_identifier] = {
"relative_path": relative_path,
@ -983,7 +983,7 @@ async def _index_batch_files(
folder_path=folder_path,
folder_name=folder_name,
target_file_path=file_path,
root_folder_id=root_folder_id,
root_folder_id=root_folder_id,
task_logger=task_logger,
log_entry=log_entry,
)
@ -1111,7 +1111,7 @@ async def _index_single_file(
folder_name=folder_name,
search_space_id=search_space_id,
user_id=user_id,
)
)
if root_folder_id:
connector_doc.folder_id = await _resolve_folder_for_file(
@ -1396,7 +1396,7 @@ async def index_uploaded_files(
folder_name=folder_name,
search_space_id=search_space_id,
user_id=user_id,
)
)
connector_doc.folder_id = await _resolve_folder_for_file(
session,

View file

@ -440,9 +440,7 @@ async def index_luma_events(
summary_content = (
f"Luma Event: {item['event_name']}\n\n{item['event_markdown']}"
)
summary_embedding = await asyncio.to_thread(
embed_text, summary_content
)
summary_embedding = await asyncio.to_thread(embed_text, summary_content)
chunks = await create_document_chunks(item["event_markdown"])

View file

@ -308,7 +308,7 @@ async def index_notion_pages(
connector_id=connector_id,
search_space_id=search_space_id,
user_id=user_id,
)
)
with session.no_autoflush:
duplicate = await check_duplicate_document_by_hash(

View file

@ -318,9 +318,7 @@ async def index_crawled_urls(
continue
# Format content as structured document for summary generation
structured_document = crawler.format_to_structured_document(
crawl_result
)
crawler.format_to_structured_document(crawl_result)
# Generate content hash using a version WITHOUT metadata
structured_document_for_hash = crawler.format_to_structured_document(
@ -332,8 +330,8 @@ async def index_crawled_urls(
# Extract useful metadata
title = metadata.get("title", url)
description = metadata.get("description", "")
language = metadata.get("language", "")
metadata.get("description", "")
metadata.get("language", "")
# Update title immediately for better UX
document.title = title