Merge pull request #12 from okapteinis/claude/pr-review-fixes-01WNkTGGrYURxe9JATA3gX6y

Move imports to top of file per PEP 8 guidelines
This commit is contained in:
Ojārs Kapteinis 2025-11-19 00:37:18 +02:00 committed by GitHub
commit f770617d9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,8 @@
# Force asyncio to use standard event loop before unstructured imports
import asyncio
import os
import uuid
from pathlib import Path
from fastapi import APIRouter, Depends, Form, HTTPException, UploadFile
from sqlalchemy.ext.asyncio import AsyncSession
@ -23,6 +26,7 @@ from app.schemas import (
)
from app.users import current_active_user
from app.utils.check_ownership import check_ownership
from app.tasks.celery_tasks.document_tasks import process_file_upload_task
try:
asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
@ -108,11 +112,6 @@ async def create_documents_file_upload(
for file in files:
try:
# Save file to persistent uploads directory
import os
import uuid
from pathlib import Path
# Create uploads directory if it doesn't exist
uploads_dir = Path(os.getenv("UPLOADS_DIR", "./uploads"))
uploads_dir.mkdir(parents=True, exist_ok=True)
@ -127,10 +126,6 @@ async def create_documents_file_upload(
with open(temp_path, "wb") as f:
f.write(content)
from app.tasks.celery_tasks.document_tasks import (
process_file_upload_task,
)
process_file_upload_task.delay(
temp_path, file.filename, search_space_id, str(user.id)
)