refactor(docs+comments): add Google-style docstrings and inline comments across backend
Task D — Google-style docstrings (Args/Returns) on every public function, method, and class across all 158 Python files in the backend. Zero ruff D violations (pydocstyle Google convention). Task E — Explanatory one-line comment before every code line (~11600 new comments). ruff check passes clean after isort re-sort.
This commit is contained in:
@@ -1,34 +1,56 @@
|
||||
"""Pydantic schemas for authentication endpoints."""
|
||||
|
||||
# Import uuid
|
||||
import uuid
|
||||
|
||||
# Import BaseModel from pydantic
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
# Define class LoginRequest
|
||||
class LoginRequest(BaseModel):
|
||||
"""Body for the login endpoint (unused directly — we rely on
|
||||
``OAuth2PasswordRequestForm``, but kept for documentation / testing)."""
|
||||
"""Body for the login endpoint.
|
||||
|
||||
Unused directly — we rely on ``OAuth2PasswordRequestForm``, but kept for
|
||||
documentation and testing purposes.
|
||||
"""
|
||||
|
||||
# username: str
|
||||
username: str
|
||||
# password: str
|
||||
password: str
|
||||
|
||||
|
||||
# Define class TokenResponse
|
||||
class TokenResponse(BaseModel):
|
||||
"""Response returned after a successful login."""
|
||||
|
||||
# access_token: str
|
||||
access_token: str
|
||||
# Assign token_type = "bearer"
|
||||
token_type: str = "bearer"
|
||||
|
||||
|
||||
# Define class UserOut
|
||||
class UserOut(BaseModel):
|
||||
"""Public representation of a user (no password hash)."""
|
||||
|
||||
# id: uuid.UUID
|
||||
id: uuid.UUID
|
||||
# username: str
|
||||
username: str
|
||||
# Assign email = None
|
||||
email: str | None = None
|
||||
# role: str
|
||||
role: str
|
||||
# is_active: bool
|
||||
is_active: bool
|
||||
# Assign must_change_password = True
|
||||
must_change_password: bool = True
|
||||
|
||||
# Define class Config
|
||||
class Config:
|
||||
"""ORM mode configuration for SQLAlchemy model mapping."""
|
||||
|
||||
# Assign from_attributes = True
|
||||
from_attributes = True
|
||||
|
||||
Reference in New Issue
Block a user