Fix linting errors across backend and frontend
All checks were successful
CI / backend-lint (push) Successful in 7s
CI / frontend-lint (push) Successful in 29s

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:
Julian Tabel
2026-02-10 12:26:57 +01:00
parent 7f8890086f
commit e4111c67bc
48 changed files with 1225 additions and 883 deletions

View File

@@ -8,8 +8,8 @@ from sqlalchemy.orm import joinedload, selectinload
from app.core.database import get_session
from app.models.encounter import Encounter
from app.models.evolution import Evolution
from app.models.genlocke_transfer import GenlockeTransfer
from app.models.genlocke import GenlockeLeg
from app.models.genlocke_transfer import GenlockeTransfer
from app.models.nuzlocke_run import NuzlockeRun
from app.models.pokemon import Pokemon
from app.models.route import Route
@@ -60,7 +60,11 @@ async def create_encounter(
# Shiny clause: shiny encounters bypass the route-lock check
shiny_clause_on = run.rules.get("shinyClause", True) if run.rules else True
skip_route_lock = (data.is_shiny and shiny_clause_on) or data.origin in ("shed_evolution", "egg", "transfer")
skip_route_lock = (data.is_shiny and shiny_clause_on) or data.origin in (
"shed_evolution",
"egg",
"transfer",
)
# If this route has a parent, check if sibling already has an encounter
if route.parent_route_id is not None and not skip_route_lock:
@@ -78,7 +82,8 @@ async def create_encounter(
# Zone-aware: only check siblings in the same zone (null treated as 0)
my_zone = route.pinwheel_zone if route.pinwheel_zone is not None else 0
sibling_ids = [
s.id for s in siblings
s.id
for s in siblings
if (s.pinwheel_zone if s.pinwheel_zone is not None else 0) == my_zone
]
else:
@@ -89,8 +94,7 @@ async def create_encounter(
# Exclude transfer-target encounters so they don't block the starter
transfer_target_ids = select(GenlockeTransfer.target_encounter_id)
existing_encounter = await session.execute(
select(Encounter)
.where(
select(Encounter).where(
Encounter.run_id == run_id,
Encounter.route_id.in_(sibling_ids),
~Encounter.id.in_(transfer_target_ids),
@@ -197,6 +201,7 @@ async def bulk_randomize_encounters(
# 2. Get version_group_id from game
from app.models.game import Game
game = await session.get(Game, game_id)
if game is None or game.version_group_id is None:
raise HTTPException(status_code=400, detail="Game has no version group")
@@ -257,8 +262,7 @@ async def bulk_randomize_encounters(
leg = leg_result.scalar_one_or_none()
if leg:
genlocke_result = await session.execute(
select(GenlockeLeg.retired_pokemon_ids)
.where(
select(GenlockeLeg.retired_pokemon_ids).where(
GenlockeLeg.genlocke_id == leg.genlocke_id,
GenlockeLeg.leg_order < leg.leg_order,
GenlockeLeg.retired_pokemon_ids.isnot(None),
@@ -268,7 +272,6 @@ async def bulk_randomize_encounters(
duped.update(retired_ids)
# 8. Organize routes: identify top-level and children
routes_by_id = {r.id: r for r in all_routes}
top_level = [r for r in all_routes if r.parent_route_id is None]
children_by_parent: dict[int, list[Route]] = {}
for r in all_routes:
@@ -289,7 +292,11 @@ async def bulk_randomize_encounters(
if parent_route.id in encountered_route_ids:
continue
available = route_pokemon.get(parent_route.id, [])
eligible = [p for p in available if p not in duped] if dupes_clause_on else available
eligible = (
[p for p in available if p not in duped]
if dupes_clause_on
else available
)
if not eligible:
skipped += 1
continue
@@ -335,7 +342,11 @@ async def bulk_randomize_encounters(
if p not in zone_pokemon:
zone_pokemon.append(p)
eligible = [p for p in zone_pokemon if p not in duped] if dupes_clause_on else zone_pokemon
eligible = (
[p for p in zone_pokemon if p not in duped]
if dupes_clause_on
else zone_pokemon
)
if not eligible:
skipped += 1
continue
@@ -371,7 +382,11 @@ async def bulk_randomize_encounters(
if p not in group_pokemon:
group_pokemon.append(p)
eligible = [p for p in group_pokemon if p not in duped] if dupes_clause_on else group_pokemon
eligible = (
[p for p in group_pokemon if p not in duped]
if dupes_clause_on
else group_pokemon
)
if not eligible:
skipped += 1
continue