style: apply black and isort formatting across entire codebase

- Standardize quote style (single to double quotes)
- Reorder and group imports alphabetically
- Fix line breaks and indentation for consistency
- Apply PEP 8 formatting standards

Also updated Makefile to exclude both venv and .venv from code quality checks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-28 19:30:17 +01:00
parent 13f0094743
commit 21c13ca39b
236 changed files with 8450 additions and 6545 deletions

View File

@@ -17,29 +17,30 @@ This script is idempotent - safe to run multiple times.
"""
import sys
from pathlib import Path
from datetime import datetime, timezone
from pathlib import Path
# Add project root to path
project_root = Path(__file__).parent.parent
sys.path.insert(0, str(project_root))
from sqlalchemy.orm import Session
from sqlalchemy import select
from sqlalchemy.orm import Session
from app.core.config import (print_environment_info, settings,
validate_production_settings)
from app.core.database import SessionLocal
from app.core.config import settings, print_environment_info, validate_production_settings
from app.core.environment import is_production, get_environment
from models.database.user import User
from models.database.admin import AdminSetting
from middleware.auth import AuthManager
from app.core.environment import get_environment, is_production
from app.core.permissions import PermissionGroups
from middleware.auth import AuthManager
from models.database.admin import AdminSetting
from models.database.user import User
# =============================================================================
# HELPER FUNCTIONS
# =============================================================================
def print_header(text: str):
"""Print formatted header."""
print("\n" + "=" * 70)
@@ -71,6 +72,7 @@ def print_error(text: str):
# INITIALIZATION FUNCTIONS
# =============================================================================
def create_admin_user(db: Session, auth_manager: AuthManager) -> User:
"""Create or get the platform admin user."""
@@ -206,9 +208,7 @@ def create_admin_settings(db: Session) -> int:
for setting_data in default_settings:
# Check if setting already exists
existing = db.execute(
select(AdminSetting).where(
AdminSetting.key == setting_data["key"]
)
select(AdminSetting).where(AdminSetting.key == setting_data["key"])
).scalar_one_or_none()
if not existing:
@@ -281,6 +281,7 @@ def verify_rbac_schema(db: Session) -> bool:
# MAIN INITIALIZATION
# =============================================================================
def initialize_production(db: Session, auth_manager: AuthManager):
"""Initialize production database with essential data."""
@@ -362,6 +363,7 @@ def print_summary(db: Session):
# MAIN ENTRY POINT
# =============================================================================
def main():
"""Main entry point."""
@@ -405,6 +407,7 @@ def main():
print_header("❌ INITIALIZATION FAILED")
print(f"\nError: {e}\n")
import traceback
traceback.print_exc()
sys.exit(1)