chore: ruff 代码检查与修复
130 issues auto-fixed (import ordering, UP045/UP006 type annotations), 33 issues manually fixed (E712/E501/E402/E722 + N818 rename + per-file wechat ignore for N8xx naming conventions). All 33 tests pass.
This commit is contained in:
+5
-4
@@ -1,9 +1,11 @@
|
||||
import logging
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker, AsyncSession
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
||||
|
||||
from app.api.router import api_router
|
||||
from app.config import settings
|
||||
from app.models.announcement import Base
|
||||
|
||||
engine = create_async_engine(settings.database_url, echo=settings.debug)
|
||||
async_session = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
||||
@@ -20,7 +22,7 @@ async def lifespan(app: FastAPI):
|
||||
level=getattr(logging, settings.log_level),
|
||||
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
|
||||
)
|
||||
from app.scheduler.jobs import start_scheduler, shutdown_scheduler
|
||||
from app.scheduler.jobs import shutdown_scheduler, start_scheduler
|
||||
start_scheduler()
|
||||
yield
|
||||
shutdown_scheduler()
|
||||
@@ -35,7 +37,6 @@ app = FastAPI(
|
||||
redoc_url=None,
|
||||
)
|
||||
|
||||
from app.api.router import api_router
|
||||
app.include_router(api_router)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user