fix ruff lint errors across all source files

Auto-fixed import sorting (I001) and unused imports (F401) via ruff --fix.
Manually fixed unused variable month_ago (F841) and lambda assignment (E731).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-02-13 16:00:37 +01:00
parent 76ef8f1c29
commit be35738997
12 changed files with 35 additions and 41 deletions

View File

@@ -2,13 +2,13 @@
Admin domain: password-protected admin panel for managing users, tasks, etc.
"""
import secrets
from functools import wraps
from datetime import datetime, timedelta
from functools import wraps
from pathlib import Path
from quart import Blueprint, render_template, request, redirect, url_for, flash, session, g
from quart import Blueprint, flash, redirect, render_template, request, session, url_for
from ..core import config, fetch_one, fetch_all, execute, csrf_protect
from ..core import config, csrf_protect, execute, fetch_all, fetch_one
# Blueprint with its own template folder
bp = Blueprint(
@@ -42,8 +42,6 @@ async def get_dashboard_stats() -> dict:
now = datetime.utcnow()
today = now.date().isoformat()
week_ago = (now - timedelta(days=7)).isoformat()
month_ago = (now - timedelta(days=30)).isoformat()
users_total = await fetch_one("SELECT COUNT(*) as count FROM users WHERE deleted_at IS NULL")
users_today = await fetch_one(
"SELECT COUNT(*) as count FROM users WHERE created_at >= ? AND deleted_at IS NULL",

View File

@@ -1,10 +1,11 @@
"""
Padelnomics - Application factory and entry point.
"""
from quart import Quart, g, session
from pathlib import Path
from .core import config, init_db, close_db, get_csrf_token, setup_request_id
from quart import Quart, g, session
from .core import close_db, config, get_csrf_token, init_db, setup_request_id
def create_app() -> Quart:
@@ -76,13 +77,13 @@ def create_app() -> Quart:
return {"status": "unhealthy", "db": str(e)}, 500
# Register blueprints
from .admin.routes import bp as admin_bp
from .auth.routes import bp as auth_bp
from .billing.routes import bp as billing_bp
from .dashboard.routes import bp as dashboard_bp
from .public.routes import bp as public_bp
from .planner.routes import bp as planner_bp
from .leads.routes import bp as leads_bp
from .admin.routes import bp as admin_bp
from .planner.routes import bp as planner_bp
from .public.routes import bp as public_bp
app.register_blueprint(public_bp)
app.register_blueprint(auth_bp)

View File

@@ -2,13 +2,13 @@
Auth domain: magic link authentication, user management, decorators.
"""
import secrets
from functools import wraps
from datetime import datetime, timedelta
from functools import wraps
from pathlib import Path
from quart import Blueprint, render_template, request, redirect, url_for, session, flash, g
from quart import Blueprint, flash, g, redirect, render_template, request, session, url_for
from ..core import config, fetch_one, fetch_all, execute, csrf_protect
from ..core import config, csrf_protect, execute, fetch_one
# Blueprint with its own template folder
bp = Blueprint(

View File

@@ -8,18 +8,11 @@ from datetime import datetime
from functools import wraps
from pathlib import Path
from quart import Blueprint, render_template, request, redirect, url_for, flash, g, jsonify, session
import httpx
from ..core import config, fetch_one, fetch_all, execute
from ..core import verify_hmac_signature
from quart import Blueprint, flash, g, jsonify, redirect, render_template, request, session, url_for
from ..auth.routes import login_required
from ..core import config, execute, fetch_one, verify_hmac_signature
# Blueprint with its own template folder
bp = Blueprint(

View File

@@ -1,18 +1,19 @@
"""
Core infrastructure: database, config, email, and shared utilities.
"""
import os
import secrets
import hashlib
import hmac
import os
import secrets
from contextvars import ContextVar
from datetime import datetime, timedelta
from functools import wraps
from pathlib import Path
import aiosqlite
import httpx
from pathlib import Path
from functools import wraps
from datetime import datetime, timedelta
from contextvars import ContextVar
from quart import request, session, g
from dotenv import load_dotenv
from quart import g, request, session
load_dotenv()

View File

@@ -4,10 +4,10 @@ Dashboard domain: user dashboard and settings.
from datetime import datetime
from pathlib import Path
from quart import Blueprint, render_template, request, redirect, url_for, flash, g
from quart import Blueprint, flash, g, redirect, render_template, request, url_for
from ..core import fetch_one, csrf_protect, soft_delete
from ..auth.routes import login_required, update_user
from ..core import csrf_protect, fetch_one, soft_delete
bp = Blueprint(
"dashboard",

View File

@@ -4,10 +4,10 @@ Leads domain: capture interest in court suppliers and financing.
from datetime import datetime
from pathlib import Path
from quart import Blueprint, render_template, request, flash, redirect, url_for, g
from quart import Blueprint, flash, g, redirect, render_template, request, url_for
from ..core import config, execute, fetch_one, csrf_protect, send_email
from ..auth.routes import login_required
from ..core import config, csrf_protect, execute, fetch_one, send_email
bp = Blueprint(
"leads",

View File

@@ -1,10 +1,10 @@
"""
Simple migration runner. Runs schema.sql against the database.
"""
import sqlite3
from pathlib import Path
import os
import sqlite3
import sys
from pathlib import Path
# Add parent to path for imports
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))

View File

@@ -6,9 +6,11 @@ model is no longer exposed in client-side JavaScript.
"""
import math
# JS-compatible rounding: half-up (0.5 rounds to 1), not Python's
# banker's rounding (round-half-even).
_round = lambda n: math.floor(n + 0.5)
def _round(n):
return math.floor(n + 0.5)
# -- Default state (mirrors the JS `S` object) --

View File

@@ -5,10 +5,10 @@ import json
from datetime import datetime
from pathlib import Path
from quart import Blueprint, render_template, request, g, jsonify
from quart import Blueprint, g, jsonify, render_template, request
from ..core import fetch_one, fetch_all, execute, csrf_protect
from ..auth.routes import login_required
from ..core import csrf_protect, execute, fetch_all, fetch_one
from .calculator import calc, validate_state
bp = Blueprint(

View File

@@ -3,7 +3,7 @@ Public domain: landing page, marketing pages, legal pages.
"""
from pathlib import Path
from quart import Blueprint, render_template, Response
from quart import Blueprint, Response, render_template
from ..core import config

View File

@@ -6,8 +6,7 @@ import json
import traceback
from datetime import datetime, timedelta
from .core import config, init_db, fetch_one, fetch_all, execute, send_email
from .core import config, execute, fetch_all, init_db, send_email
# Task handlers registry
HANDLERS: dict[str, callable] = {}