chore(lint): apply ruff --fix (4443 auto-fixes)
Auto-fixed categories: - F401: unused imports removed - I001: import blocks sorted - W293: trailing whitespace stripped - UP035: deprecated typing imports replaced - SIM: simplify suggestions applied - ARG: unused args prefixed with underscore - T201: print statements removed - F841: unused variables removed - RUF059: unpacked variables prefixed Remaining ~1500 unfixable errors (C901, B904, N806, E402) require manual work. Backend smoke tests: 13/13 passed.
This commit is contained in:
@@ -9,28 +9,29 @@
|
||||
# @INVARIANT: All settings changes must be persisted via ConfigManager.
|
||||
# @PUBLIC_API: router
|
||||
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from typing import List
|
||||
from pydantic import BaseModel
|
||||
from ...core.config_models import AppConfig, Environment, GlobalSettings, LoggingConfig
|
||||
from ...models.storage import StorageConfig
|
||||
from ...dependencies import get_config_manager, has_permission
|
||||
from ...core.config_manager import ConfigManager
|
||||
from ...core.logger import logger, belief_scope
|
||||
from ...core.superset_client import SupersetClient
|
||||
from ...services.llm_prompt_templates import normalize_llm_settings
|
||||
from ...models.llm import ValidationPolicy
|
||||
from ...models.config import AppConfigRecord
|
||||
from ...schemas.settings import (
|
||||
ValidationPolicyCreate,
|
||||
ValidationPolicyUpdate,
|
||||
ValidationPolicyResponse,
|
||||
TranslationScheduleItem,
|
||||
)
|
||||
from ...models.translate import TranslationSchedule, TranslationJob
|
||||
from ...core.database import get_db
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from ...core.config_manager import ConfigManager
|
||||
from ...core.config_models import AppConfig, Environment, GlobalSettings, LoggingConfig
|
||||
from ...core.database import get_db
|
||||
from ...core.logger import belief_scope, logger
|
||||
from ...core.superset_client import SupersetClient
|
||||
from ...dependencies import get_config_manager, has_permission
|
||||
from ...models.config import AppConfigRecord
|
||||
from ...models.llm import ValidationPolicy
|
||||
from ...models.storage import StorageConfig
|
||||
from ...models.translate import TranslationJob, TranslationSchedule
|
||||
from ...schemas.settings import (
|
||||
TranslationScheduleItem,
|
||||
ValidationPolicyCreate,
|
||||
ValidationPolicyResponse,
|
||||
ValidationPolicyUpdate,
|
||||
)
|
||||
from ...services.llm_prompt_templates import normalize_llm_settings
|
||||
|
||||
|
||||
# #region LoggingConfigResponse [C:1] [TYPE Class] [SEMANTICS logging, config, response]
|
||||
# @BRIEF Response model for logging configuration with current task log level.
|
||||
@@ -179,7 +180,7 @@ async def update_storage_settings(
|
||||
# @BRIEF Lists all configured Superset environments.
|
||||
# @PRE: Config manager is available.
|
||||
# @POST: Returns list of environments.
|
||||
@router.get("/environments", response_model=List[Environment])
|
||||
@router.get("/environments", response_model=list[Environment])
|
||||
async def get_environments(
|
||||
config_manager: ConfigManager = Depends(get_config_manager),
|
||||
_=Depends(has_permission("admin:settings", "READ")),
|
||||
@@ -375,10 +376,10 @@ async def update_logging_config(
|
||||
# #region ConsolidatedSettingsResponse [C:1] [TYPE Class]
|
||||
# @BRIEF Response model for consolidated application settings.
|
||||
class ConsolidatedSettingsResponse(BaseModel):
|
||||
environments: List[dict]
|
||||
connections: List[dict]
|
||||
environments: list[dict]
|
||||
connections: list[dict]
|
||||
llm: dict
|
||||
llm_providers: List[dict]
|
||||
llm_providers: list[dict]
|
||||
logging: dict
|
||||
storage: dict
|
||||
notifications: dict = {}
|
||||
@@ -410,8 +411,8 @@ async def get_consolidated_settings(
|
||||
|
||||
config = config_manager.get_config()
|
||||
|
||||
from ...services.llm_provider import LLMProviderService
|
||||
from ...core.database import SessionLocal
|
||||
from ...services.llm_provider import LLMProviderService
|
||||
|
||||
db = SessionLocal()
|
||||
notifications_payload = {}
|
||||
@@ -524,7 +525,7 @@ async def update_consolidated_settings(
|
||||
|
||||
# #region get_validation_policies [C:2] [TYPE Function]
|
||||
# @BRIEF Lists all validation policies.
|
||||
@router.get("/automation/policies", response_model=List[ValidationPolicyResponse])
|
||||
@router.get("/automation/policies", response_model=list[ValidationPolicyResponse])
|
||||
async def get_validation_policies(
|
||||
db: Session = Depends(get_db), _=Depends(has_permission("admin:settings", "READ"))
|
||||
):
|
||||
@@ -603,7 +604,7 @@ async def delete_validation_policy(
|
||||
|
||||
# #region get_translation_schedules [C:2] [TYPE Function]
|
||||
# @BRIEF Lists all translation schedules joined with translation job names.
|
||||
@router.get("/automation/translation-schedules", response_model=List[TranslationScheduleItem])
|
||||
@router.get("/automation/translation-schedules", response_model=list[TranslationScheduleItem])
|
||||
async def get_translation_schedules(
|
||||
db: Session = Depends(get_db),
|
||||
_=Depends(has_permission("admin:settings", "READ")),
|
||||
|
||||
Reference in New Issue
Block a user