chore(quality): apply ruff autofixes and formatting (29 fixes, 41 files reformatted)

This commit is contained in:
Agent Zero
2026-06-10 21:31:41 +00:00
parent 054d4041e6
commit 7c12a96cdc
43 changed files with 1096 additions and 524 deletions
+16 -7
View File
@@ -4,7 +4,7 @@ from fastapi import APIRouter, Depends, HTTPException, status, Query
from sqlalchemy import select, func
from sqlalchemy.ext.asyncio import AsyncSession
from app.api.deps import get_current_user, require_permission
from app.api.deps import require_permission
from app.db.session import get_async_session
from app.models import User, StockLocation
from app.schemas.stock_location import (
@@ -48,7 +48,9 @@ async def list_stock_locations(
)
@router.post("", response_model=StockLocationResponse, status_code=status.HTTP_201_CREATED)
@router.post(
"", response_model=StockLocationResponse, status_code=status.HTTP_201_CREATED
)
async def create_stock_location(
body: StockLocationCreateRequest,
current_user: User = Depends(require_permission("equipment:write")),
@@ -60,8 +62,9 @@ async def create_stock_location(
# If this is set as default, unset others
if body.is_default:
await session.execute(
select(StockLocation)
.where(StockLocation.account_id == account_id, StockLocation.is_default == True) # noqa: E712
select(StockLocation).where(
StockLocation.account_id == account_id, StockLocation.is_default == True
) # noqa: E712
)
loc = StockLocation(account_id=account_id, **body.model_dump())
@@ -87,7 +90,9 @@ async def get_stock_location(
)
loc = result.scalars().first()
if not loc:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Stock location not found")
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail="Stock location not found"
)
return StockLocationResponse.model_validate(loc)
@@ -108,7 +113,9 @@ async def update_stock_location(
)
loc = result.scalars().first()
if not loc:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Stock location not found")
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail="Stock location not found"
)
update_data = body.model_dump(exclude_unset=True)
for field, value in update_data.items():
@@ -135,7 +142,9 @@ async def delete_stock_location(
)
loc = result.scalars().first()
if not loc:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Stock location not found")
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail="Stock location not found"
)
await session.delete(loc)
await session.commit()