fix: resolve all 64 mypy errors across backend
- Add dict[str, Any] / list[Any] type params throughout (fingerprint, models, schemas, scanner, status_checker) - Add return type annotations to all route functions (nodes, edges, canvas, scan, auth, status, main) - Fix no-any-return in security.py: cast pwd/jwt results to bool/str explicitly - Fix canvas.py: use model_validate() for NodeResponse/EdgeResponse, rename db_node/db_edge upsert vars - Fix scheduler.py: rename 'result' → 'check_result' to avoid type collision - Fix get_db() return type: AsyncGenerator[AsyncSession, None] - Add types-PyYAML for yaml import stubs - Fix scanner.py: remove unnecessary type: ignore comment (nmap has stubs) - Fix scan.py: wrap scalars().all() with list() for Sequence→list compatibility
This commit is contained in:
+4
-2
@@ -1,4 +1,6 @@
|
||||
from collections.abc import AsyncGenerator
|
||||
from contextlib import asynccontextmanager
|
||||
from typing import Any
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
@@ -10,7 +12,7 @@ from app.db.database import init_db
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
await init_db()
|
||||
start_scheduler()
|
||||
yield
|
||||
@@ -40,5 +42,5 @@ app.include_router(status.router, prefix="/api/v1/status", tags=["status"])
|
||||
|
||||
|
||||
@app.get("/api/v1/health")
|
||||
async def health():
|
||||
async def health() -> dict[str, Any]:
|
||||
return {"status": "ok"}
|
||||
|
||||
Reference in New Issue
Block a user