chore: ran backend linting

This commit is contained in:
Anish Sarkar 2026-01-28 09:10:37 +05:30
parent aab547264e
commit c125c9e87f
4 changed files with 32 additions and 23 deletions

View file

@ -505,10 +505,11 @@ async def check_document_by_google_drive_file_id(
Document.search_space_id == search_space_id, Document.search_space_id == search_space_id,
or_( or_(
# Normal Google Drive connector format # Normal Google Drive connector format
cast(Document.document_metadata["google_drive_file_id"], String) == quoted_file_id, cast(Document.document_metadata["google_drive_file_id"], String)
== quoted_file_id,
# Composio Google Drive connector format # Composio Google Drive connector format
cast(Document.document_metadata["file_id"], String) == quoted_file_id, cast(Document.document_metadata["file_id"], String) == quoted_file_id,
) ),
) )
) )
return existing_doc_result.scalars().first() return existing_doc_result.scalars().first()
@ -601,8 +602,8 @@ async def index_composio_google_drive(
# Detect if settings changed since last index # Detect if settings changed since last index
settings_changed = ( settings_changed = (
last_settings_hash is not None and last_settings_hash is not None
current_settings_hash != last_settings_hash and current_settings_hash != last_settings_hash
) )
if settings_changed: if settings_changed:
@ -620,10 +621,10 @@ async def index_composio_google_drive(
# - User must have incremental_sync enabled # - User must have incremental_sync enabled
# - Settings must not have changed (folder/subfolder config) # - Settings must not have changed (folder/subfolder config)
use_delta_sync = ( use_delta_sync = (
incremental_sync and incremental_sync
stored_page_token and and stored_page_token
connector.last_indexed_at and and connector.last_indexed_at
not settings_changed and not settings_changed
) )
# Route to delta sync or full scan # Route to delta sync or full scan
@ -1177,7 +1178,9 @@ async def _process_single_drive_file(
# Check if content_hash already exists (from any connector) # Check if content_hash already exists (from any connector)
# This prevents duplicate content and avoids IntegrityError on unique constraint # This prevents duplicate content and avoids IntegrityError on unique constraint
existing_by_content_hash = await check_document_by_content_hash(session, content_hash) existing_by_content_hash = await check_document_by_content_hash(
session, content_hash
)
if existing_by_content_hash: if existing_by_content_hash:
logger.info( logger.info(
f"Skipping file {file_name} (file_id={file_id}): identical content " f"Skipping file {file_name} (file_id={file_id}): identical content "

View file

@ -123,7 +123,9 @@ async def list_all_permissions(
for perm in Permission: for perm in Permission:
# Extract category from permission value (e.g., "documents:read" -> "documents") # Extract category from permission value (e.g., "documents:read" -> "documents")
category = perm.value.split(":")[0] if ":" in perm.value else "general" category = perm.value.split(":")[0] if ":" in perm.value else "general"
description = PERMISSION_DESCRIPTIONS.get(perm.value, f"Permission for {perm.value}") description = PERMISSION_DESCRIPTIONS.get(
perm.value, f"Permission for {perm.value}"
)
permissions.append( permissions.append(
PermissionInfo( PermissionInfo(

View file

@ -360,7 +360,9 @@ class ConnectorIndexingNotificationHandler(BaseNotificationHandler):
skipped_text = "" skipped_text = ""
if skipped_count and skipped_count > 0: if skipped_count and skipped_count > 0:
skipped_item_text = "item" if skipped_count == 1 else "items" skipped_item_text = "item" if skipped_count == 1 else "items"
skipped_text = f" ({skipped_count} {skipped_item_text} skipped - already indexed)" skipped_text = (
f" ({skipped_count} {skipped_item_text} skipped - already indexed)"
)
# If there's an error message but items were indexed, treat it as a warning (partial success) # If there's an error message but items were indexed, treat it as a warning (partial success)
# If is_warning is True, treat it as success even with 0 items (e.g., duplicates found) # If is_warning is True, treat it as success even with 0 items (e.g., duplicates found)
@ -392,7 +394,9 @@ class ConnectorIndexingNotificationHandler(BaseNotificationHandler):
message = "Already up to date! No new items to sync." message = "Already up to date! No new items to sync."
else: else:
item_text = "item" if indexed_count == 1 else "items" item_text = "item" if indexed_count == 1 else "items"
message = f"Now searchable! {indexed_count} {item_text} synced{skipped_text}." message = (
f"Now searchable! {indexed_count} {item_text} synced{skipped_text}."
)
status = "completed" status = "completed"
metadata_updates = { metadata_updates = {