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:
@@ -2,13 +2,13 @@
|
|||||||
Admin domain: password-protected admin panel for managing users, tasks, etc.
|
Admin domain: password-protected admin panel for managing users, tasks, etc.
|
||||||
"""
|
"""
|
||||||
import secrets
|
import secrets
|
||||||
from functools import wraps
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from functools import wraps
|
||||||
from pathlib import Path
|
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
|
# Blueprint with its own template folder
|
||||||
bp = Blueprint(
|
bp = Blueprint(
|
||||||
@@ -42,8 +42,6 @@ async def get_dashboard_stats() -> dict:
|
|||||||
now = datetime.utcnow()
|
now = datetime.utcnow()
|
||||||
today = now.date().isoformat()
|
today = now.date().isoformat()
|
||||||
week_ago = (now - timedelta(days=7)).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_total = await fetch_one("SELECT COUNT(*) as count FROM users WHERE deleted_at IS NULL")
|
||||||
users_today = await fetch_one(
|
users_today = await fetch_one(
|
||||||
"SELECT COUNT(*) as count FROM users WHERE created_at >= ? AND deleted_at IS NULL",
|
"SELECT COUNT(*) as count FROM users WHERE created_at >= ? AND deleted_at IS NULL",
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
"""
|
"""
|
||||||
Padelnomics - Application factory and entry point.
|
Padelnomics - Application factory and entry point.
|
||||||
"""
|
"""
|
||||||
from quart import Quart, g, session
|
|
||||||
from pathlib import Path
|
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:
|
def create_app() -> Quart:
|
||||||
@@ -76,13 +77,13 @@ def create_app() -> Quart:
|
|||||||
return {"status": "unhealthy", "db": str(e)}, 500
|
return {"status": "unhealthy", "db": str(e)}, 500
|
||||||
|
|
||||||
# Register blueprints
|
# Register blueprints
|
||||||
|
from .admin.routes import bp as admin_bp
|
||||||
from .auth.routes import bp as auth_bp
|
from .auth.routes import bp as auth_bp
|
||||||
from .billing.routes import bp as billing_bp
|
from .billing.routes import bp as billing_bp
|
||||||
from .dashboard.routes import bp as dashboard_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 .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(public_bp)
|
||||||
app.register_blueprint(auth_bp)
|
app.register_blueprint(auth_bp)
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
Auth domain: magic link authentication, user management, decorators.
|
Auth domain: magic link authentication, user management, decorators.
|
||||||
"""
|
"""
|
||||||
import secrets
|
import secrets
|
||||||
from functools import wraps
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
from functools import wraps
|
||||||
from pathlib import Path
|
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
|
# Blueprint with its own template folder
|
||||||
bp = Blueprint(
|
bp = Blueprint(
|
||||||
|
|||||||
@@ -8,18 +8,11 @@ from datetime import datetime
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from quart import Blueprint, render_template, request, redirect, url_for, flash, g, jsonify, session
|
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
|
from quart import Blueprint, flash, g, jsonify, redirect, render_template, request, session, url_for
|
||||||
|
|
||||||
from ..core import config, fetch_one, fetch_all, execute
|
|
||||||
|
|
||||||
from ..core import verify_hmac_signature
|
|
||||||
|
|
||||||
from ..auth.routes import login_required
|
from ..auth.routes import login_required
|
||||||
|
from ..core import config, execute, fetch_one, verify_hmac_signature
|
||||||
|
|
||||||
|
|
||||||
# Blueprint with its own template folder
|
# Blueprint with its own template folder
|
||||||
bp = Blueprint(
|
bp = Blueprint(
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
"""
|
"""
|
||||||
Core infrastructure: database, config, email, and shared utilities.
|
Core infrastructure: database, config, email, and shared utilities.
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import secrets
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
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 aiosqlite
|
||||||
import httpx
|
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 dotenv import load_dotenv
|
||||||
|
from quart import g, request, session
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ Dashboard domain: user dashboard and settings.
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
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 ..auth.routes import login_required, update_user
|
||||||
|
from ..core import csrf_protect, fetch_one, soft_delete
|
||||||
|
|
||||||
bp = Blueprint(
|
bp = Blueprint(
|
||||||
"dashboard",
|
"dashboard",
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ Leads domain: capture interest in court suppliers and financing.
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
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 ..auth.routes import login_required
|
||||||
|
from ..core import config, csrf_protect, execute, fetch_one, send_email
|
||||||
|
|
||||||
bp = Blueprint(
|
bp = Blueprint(
|
||||||
"leads",
|
"leads",
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
"""
|
"""
|
||||||
Simple migration runner. Runs schema.sql against the database.
|
Simple migration runner. Runs schema.sql against the database.
|
||||||
"""
|
"""
|
||||||
import sqlite3
|
|
||||||
from pathlib import Path
|
|
||||||
import os
|
import os
|
||||||
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# Add parent to path for imports
|
# Add parent to path for imports
|
||||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
|
sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ model is no longer exposed in client-side JavaScript.
|
|||||||
"""
|
"""
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|
||||||
# JS-compatible rounding: half-up (0.5 rounds to 1), not Python's
|
# JS-compatible rounding: half-up (0.5 rounds to 1), not Python's
|
||||||
# banker's rounding (round-half-even).
|
# 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) --
|
# -- Default state (mirrors the JS `S` object) --
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import json
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
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 ..auth.routes import login_required
|
||||||
|
from ..core import csrf_protect, execute, fetch_all, fetch_one
|
||||||
from .calculator import calc, validate_state
|
from .calculator import calc, validate_state
|
||||||
|
|
||||||
bp = Blueprint(
|
bp = Blueprint(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Public domain: landing page, marketing pages, legal pages.
|
|||||||
"""
|
"""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from quart import Blueprint, render_template, Response
|
from quart import Blueprint, Response, render_template
|
||||||
|
|
||||||
from ..core import config
|
from ..core import config
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import json
|
|||||||
import traceback
|
import traceback
|
||||||
from datetime import datetime, timedelta
|
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
|
# Task handlers registry
|
||||||
HANDLERS: dict[str, callable] = {}
|
HANDLERS: dict[str, callable] = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user