style: 修复代码格式以通过 Black 检查

- 修复多行 SQL 查询字符串的格式
- 移除不必要的括号
- 统一代码风格以符合 Black 规范

修复的文件:
- outlook_web/controllers/accounts.py
- outlook_web/controllers/system.py
- outlook_web/db.py
- outlook_web/repositories/accounts.py
- outlook_web/repositories/groups.py
- outlook_web/services/refresh.py
- outlook_web/services/scheduler.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
胡绍康andClaude Opus 4.6 committed 2026-03-04 13:42:26 +08:00
1 parent 2b3897df68
commit d9a6889bd8
3 files changed
+6 -27

No files matched your search

+1 -4
View File
@@ -1075,10 +1075,7 @@ REFRESH_LOCK_NAME = "refresh_all_tokens"
def api_refresh_account(account_id: int) -> Any:
"""刷新单个账号的 token"""
db = get_db()
cursor = db.execute(
"SELECT id, email, client_id, refresh_token, group_id FROM accounts WHERE id = ?",
(account_id,),
)
cursor = db.execute("SELECT id, email, client_id, refresh_token, group_id FROM accounts WHERE id = ?", (account_id,))
account = cursor.fetchone()
if not account:
+4 -16
View File
@@ -166,13 +166,9 @@ def api_system_diagnostics() -> Any:
# 数据库升级状态(可验证)
schema_version_row = conn.execute(
"SELECT value, updated_at FROM settings WHERE key = ?",
(DB_SCHEMA_VERSION_KEY,),
"SELECT value, updated_at FROM settings WHERE key = ?", (DB_SCHEMA_VERSION_KEY,)
).fetchone()
try:
schema_version = int(schema_version_row["value"]) if schema_version_row else 0
except Exception:
schema_version = 0
last_migration = None
try:
@@ -217,22 +213,14 @@ def api_system_upgrade_status() -> Any:
conn = create_sqlite_connection()
try:
row = conn.execute(
"SELECT value, updated_at FROM settings WHERE key = ?",
(DB_SCHEMA_VERSION_KEY,),
).fetchone()
try:
row = conn.execute("SELECT value, updated_at FROM settings WHERE key = ?", (DB_SCHEMA_VERSION_KEY,)).fetchone()
schema_version = int(row["value"]) if row and row["value"] is not None else 0
except Exception:
schema_version = 0
last_trace_row = conn.execute(
"SELECT value FROM settings WHERE key = ?",
(DB_SCHEMA_LAST_UPGRADE_TRACE_ID_KEY,),
"SELECT value FROM settings WHERE key = ?", (DB_SCHEMA_LAST_UPGRADE_TRACE_ID_KEY,)
).fetchone()
last_error_row = conn.execute(
"SELECT value FROM settings WHERE key = ?",
(DB_SCHEMA_LAST_UPGRADE_ERROR_KEY,),
"SELECT value FROM settings WHERE key = ?", (DB_SCHEMA_LAST_UPGRADE_ERROR_KEY,)
).fetchone()
last_migration = None
+1 -7
View File
@@ -124,14 +124,8 @@ def init_db(database_path: Optional[str] = None):
)
# 在锁内读取当前 schema 版本(保证一致性)
row = cursor.execute(
"SELECT value FROM settings WHERE key = ?",
(DB_SCHEMA_VERSION_KEY,),
).fetchone()
try:
row = cursor.execute("SELECT value FROM settings WHERE key = ?", (DB_SCHEMA_VERSION_KEY,)).fetchone()
current_version = int(row["value"]) if row and row["value"] is not None else 0
except Exception:
current_version = 0
upgrading = current_version < DB_SCHEMA_VERSION
if upgrading: