refactor: use pathlib.Path for BASE_DIR, BACKEND_DIR, FRONTEND_DIR
Bandit / bandit (push) Has been cancelled
Docker Image CI / build (3.13) (push) Has been cancelled

Replaces os.path.dirname/join chains with Path(__file__).resolve() and /
operator. Updated Settings field types from str to Path to satisfy
pydantic v2 strict coercion.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 23:12:16 -05:00
co-authored by Claude Sonnet 4.5
parent 6e978b9de9
commit 49aab16f83
2 changed files with 8 additions and 8 deletions
+4 -2
View File
@@ -1,11 +1,13 @@
from pathlib import Path
from pydantic_settings import BaseSettings
from backend.settings.consts import BACKEND_DIR, FRONTEND_DIR
class Settings(BaseSettings):
backend_dir: str = BACKEND_DIR
frontend_dir: str = FRONTEND_DIR
backend_dir: Path = BACKEND_DIR
frontend_dir: Path = FRONTEND_DIR
DB_URL: str = "sqlite+aiosqlite:///backend/pygentic_ai.sqlite3"
DEBUG: bool = False
+4 -6
View File
@@ -1,13 +1,11 @@
import enum
import os
from pathlib import Path
from decouple import config
BASE_DIR = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
BACKEND_DIR = os.path.join(BASE_DIR, "backend")
FRONTEND_DIR = os.path.join(BASE_DIR, "frontend")
BASE_DIR = Path(__file__).resolve().parent.parent.parent
BACKEND_DIR = BASE_DIR / "backend"
FRONTEND_DIR = BASE_DIR / "frontend"
pg_dialects = [