Skip to content

Commit 87286d0

Browse files
committed
lint: ruff clean — fix unused imports + per-file ignores for main.py/test_email.py
1 parent 63e0b98 commit 87286d0

11 files changed

Lines changed: 15 additions & 14 deletions

app/auth.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from argon2 import PasswordHasher
1414
from argon2.exceptions import VerifyMismatchError
1515

16-
from . import db
1716
from .config import get_settings
1817

1918

app/routers/files.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"""
1717
from __future__ import annotations
1818

19-
import mimetypes
2019
import os
2120
import unicodedata
2221
from typing import Any, Optional

app/routers/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from fastapi import APIRouter, Depends, HTTPException
1+
from fastapi import APIRouter, Depends
22

33
import httpx
44

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@ testpaths = ["tests"]
4848
[tool.ruff]
4949
line-length = 100
5050
target-version = "py312"
51+
extend-exclude = ["scripts/_deprecated", "migrations/_archive"]
52+
53+
[tool.ruff.lint.per-file-ignores]
54+
# main.py imports the routers + mcp_http AFTER setting the httpx log level —
55+
# httpx logs the full request URL at INFO, which leaks the Telegram bot token.
56+
# Imports must come after `logging.getLogger("httpx").setLevel(WARNING)`.
57+
"app/main.py" = ["E402"]
58+
# Test helper class with single-line method bodies — common pytest idiom.
59+
"tests/services/test_email.py" = ["E702"]

scripts/run_migrations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def _strip_outer_transaction(sql: str) -> str:
114114

115115
# Track $$-quoted regions so we don't touch plpgsql block syntax inside them.
116116
in_dollar = False
117-
dollar_tag = ""
118117

119118
# First pass: find indices of leading BEGIN and trailing COMMIT (only when
120119
# at outermost level, only at file boundaries).

tests/mcp/test_bearer_user_binding.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
"""
1414
from __future__ import annotations
1515

16-
import base64
17-
import hashlib
18-
import secrets
1916
from uuid import UUID
2017

2118
import pytest

tests/services/test_oauth.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import base64
1515
import hashlib
1616
from datetime import datetime, timedelta, timezone
17-
from uuid import UUID
1817

1918
import pytest
2019

tests/services/test_secrets.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import pytest
32
from cryptography.fernet import Fernet
43

tests/test_auth_user_dep.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Legacy `b"authed"` cookies fall back to the sentinel user (migration grace).
55
"""
66
import pytest
7-
from uuid import UUID
87

98

109
@pytest.mark.asyncio
@@ -62,7 +61,8 @@ async def test_sentinel_user_uses_env_overrides(monkeypatch):
6261
async def test_require_user_returns_db_user_from_new_cookie_payload(client, db_conn):
6362
"""The new cookie payload carries user_id; require_user looks up users table."""
6463
from app.auth import require_user, _signer, SENTINEL_USER_ID
65-
import json, time
64+
import json
65+
import time
6666

6767
# The sentinel user already exists in the DB (seeded by Phase 1 migration).
6868
payload = json.dumps({"u": str(SENTINEL_USER_ID), "iat": int(time.time())}).encode()
@@ -78,7 +78,8 @@ async def test_require_user_unknown_user_id_in_cookie_raises_401(client, db_conn
7878
"""A signed cookie with a user_id that doesn't exist in users → 401."""
7979
from fastapi import HTTPException
8080
from app.auth import require_user, _signer
81-
import json, time
81+
import json
82+
import time
8283
from uuid import uuid4
8384

8485
unknown = str(uuid4())

tests/test_phase1_schema.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
- The operator seed row exists after migrations.
88
- Two users can have the same course code (composite PK on (user_id, code)).
99
"""
10-
from datetime import datetime, timezone, date
1110
from uuid import UUID, uuid4
1211

1312
import pytest

0 commit comments

Comments
 (0)