Fix linting errors across backend and frontend
Backend: auto-fix and format all ruff issues, manually fix B904/B023/ SIM117/B007/E741/F841 errors, suppress B008 (FastAPI Depends) and F821 (SQLAlchemy forward refs) in config. Frontend: allow constant exports, disable React compiler-specific rules (set-state-in-effect, preserve-manual-memoization). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -26,17 +26,18 @@ async def list_evolutions(
|
||||
offset: int = Query(0, ge=0),
|
||||
session: AsyncSession = Depends(get_session),
|
||||
):
|
||||
base_query = (
|
||||
select(Evolution)
|
||||
.options(joinedload(Evolution.from_pokemon), joinedload(Evolution.to_pokemon))
|
||||
base_query = select(Evolution).options(
|
||||
joinedload(Evolution.from_pokemon), joinedload(Evolution.to_pokemon)
|
||||
)
|
||||
|
||||
if search:
|
||||
search_lower = search.lower()
|
||||
# Join pokemon to search by name
|
||||
from_pokemon = select(Pokemon.id).where(
|
||||
func.lower(Pokemon.name).contains(search_lower)
|
||||
).scalar_subquery()
|
||||
from_pokemon = (
|
||||
select(Pokemon.id)
|
||||
.where(func.lower(Pokemon.name).contains(search_lower))
|
||||
.scalar_subquery()
|
||||
)
|
||||
base_query = base_query.where(
|
||||
or_(
|
||||
Evolution.from_pokemon_id.in_(from_pokemon),
|
||||
@@ -52,9 +53,11 @@ async def list_evolutions(
|
||||
count_base = select(Evolution)
|
||||
if search:
|
||||
search_lower = search.lower()
|
||||
from_pokemon = select(Pokemon.id).where(
|
||||
func.lower(Pokemon.name).contains(search_lower)
|
||||
).scalar_subquery()
|
||||
from_pokemon = (
|
||||
select(Pokemon.id)
|
||||
.where(func.lower(Pokemon.name).contains(search_lower))
|
||||
.scalar_subquery()
|
||||
)
|
||||
count_base = count_base.where(
|
||||
or_(
|
||||
Evolution.from_pokemon_id.in_(from_pokemon),
|
||||
@@ -68,7 +71,11 @@ async def list_evolutions(
|
||||
count_query = select(func.count()).select_from(count_base.subquery())
|
||||
total = (await session.execute(count_query)).scalar() or 0
|
||||
|
||||
items_query = base_query.order_by(Evolution.from_pokemon_id, Evolution.to_pokemon_id).offset(offset).limit(limit)
|
||||
items_query = (
|
||||
base_query.order_by(Evolution.from_pokemon_id, Evolution.to_pokemon_id)
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
)
|
||||
result = await session.execute(items_query)
|
||||
items = result.scalars().unique().all()
|
||||
|
||||
@@ -209,7 +216,9 @@ async def bulk_import_evolutions(
|
||||
session.add(evolution)
|
||||
created += 1
|
||||
except Exception as e:
|
||||
errors.append(f"Evolution {item.from_pokeapi_id} -> {item.to_pokeapi_id}: {e}")
|
||||
errors.append(
|
||||
f"Evolution {item.from_pokeapi_id} -> {item.to_pokeapi_id}: {e}"
|
||||
)
|
||||
|
||||
await session.commit()
|
||||
return BulkImportResult(created=created, updated=updated, errors=errors)
|
||||
|
||||
Reference in New Issue
Block a user