refactor: update parameter names in validation functions for clarity

This commit is contained in:
grillazz
2026-07-20 10:27:12 +02:00
parent a8e654f9d6
commit cb4a63b6c0
3 changed files with 4 additions and 6 deletions
+1 -3
View File
@@ -1,7 +1,6 @@
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from pathlib import Path from pathlib import Path
import asyncpg
from fastapi import Depends, FastAPI, Request from fastapi import Depends, FastAPI, Request
from fastapi.responses import HTMLResponse from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates from fastapi.templating import Jinja2Templates
@@ -23,7 +22,6 @@ from app.middleware.profiler import ProfilingMiddleware
from app.redis import get_redis from app.redis import get_redis
from app.services.auth import AuthBearer from app.services.auth import AuthBearer
from app.services.chat_agent import build_chat_agent from app.services.chat_agent import build_chat_agent
from app.services.chat_session import ChatSessionManager
templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates") templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates")
@@ -32,7 +30,7 @@ templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates"
async def lifespan(app: FastAPI): async def lifespan(app: FastAPI):
app.logger = get_logger() app.logger = get_logger()
app.redis = await get_redis() app.redis = await get_redis()
postgres_dsn = global_settings.postgres_url.unicode_string() global_settings.postgres_url.unicode_string()
# Chat service: initialize the pluggable model-client adapter. The session # Chat service: initialize the pluggable model-client adapter. The session
# manager is now a singleton and will be auto-instantiated on first access. # manager is now a singleton and will be auto-instantiated on first access.
# See app/services/chat_agent.py to swap the local stub for a real model # See app/services/chat_agent.py to swap the local stub for a real model
+2 -2
View File
@@ -72,7 +72,7 @@ class LocalEchoAgent:
return None return None
def _validate_base_url(instance: OllamaChatAgent, attribute: attrs.Attribute, value: str) -> None: def _validate_base_url(_instance: OllamaChatAgent, _attribute: attrs.Attribute, value: str) -> None:
"""Validate that base_url is a valid HTTP(S) URL. """Validate that base_url is a valid HTTP(S) URL.
Args: Args:
@@ -92,7 +92,7 @@ def _validate_base_url(instance: OllamaChatAgent, attribute: attrs.Attribute, va
raise ValueError(msg) raise ValueError(msg)
def _validate_timeout(instance: OllamaChatAgent, attribute: attrs.Attribute, value: float) -> None: def _validate_timeout(_instance: OllamaChatAgent, _attribute: attrs.Attribute, value: float) -> None:
"""Validate that timeout is positive. """Validate that timeout is positive.
Args: Args:
+1 -1
View File
@@ -2,8 +2,8 @@
import httpx import httpx
import pytest import pytest
from app.services.chat_agent import OllamaChatAgent, LocalEchoAgent, build_chat_agent
from app.config import ChatConfig from app.config import ChatConfig
from app.services.chat_agent import LocalEchoAgent, OllamaChatAgent, build_chat_agent
class TestOllamaChatAgentAttrsFeatures: class TestOllamaChatAgentAttrsFeatures: