fix(fc3c): ruff — split SyncSession import, StrEnum, ASYNC240 noqa, blank-line
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,8 @@ from typing import Any
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import Session as SyncSession, joinedload
|
||||
from sqlalchemy.orm import Session as SyncSession
|
||||
from sqlalchemy.orm import joinedload
|
||||
|
||||
from ..models import Artist, DownloadEvent, Source
|
||||
from .credential_service import CredentialService
|
||||
@@ -217,7 +218,10 @@ class DownloadService:
|
||||
if path_str in (dl_result.quarantined_paths or []):
|
||||
continue
|
||||
path = Path(path_str)
|
||||
if not path.exists():
|
||||
# Sync stdlib filesystem ops are intentional here: this orchestrator
|
||||
# runs under `asyncio.run` inside a Celery task — no other awaitables
|
||||
# compete for the loop. ASYNC240 suppressed below.
|
||||
if not path.exists(): # noqa: ASYNC240
|
||||
continue
|
||||
|
||||
def _attach(p=path):
|
||||
@@ -230,7 +234,7 @@ class DownloadService:
|
||||
if result.status in ("imported", "superseded"):
|
||||
import_summary["attached"] += 1
|
||||
try:
|
||||
bytes_downloaded += path.stat().st_size
|
||||
bytes_downloaded += path.stat().st_size # noqa: ASYNC240
|
||||
except OSError:
|
||||
pass
|
||||
elif result.status == "skipped" and result.skip_reason and result.skip_reason.value in (
|
||||
@@ -238,7 +242,7 @@ class DownloadService:
|
||||
):
|
||||
import_summary["skipped"] += 1
|
||||
try:
|
||||
path.unlink(missing_ok=True)
|
||||
path.unlink(missing_ok=True) # noqa: ASYNC240
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user