fix: 修复 mypy 类型检查错误并升级到 Python 3.14

主要变更:
- 修复 1483 个 mypy 类型检查错误
- 添加缺失的类型注解 (Any, Callable, Session 等)
- 修复隐式 Optional 类型 (param: Type = None -> param: Type | None = None)
- 修复 __new__ 单例模式返回类型
- 添加 type: ignore 注释处理第三方库类型问题
- 更新 pyproject.toml 依赖到 Python 3.14 兼容版本
- 更新 mypy/black 配置为 Python 3.14
This commit is contained in:
fawney19
2026-01-30 14:30:57 +08:00
parent 7066166757
commit 5603c72f40
142 changed files with 2864 additions and 1853 deletions

View File

@@ -21,6 +21,8 @@
logger.exception("异常,带堆栈")
"""
from __future__ import annotations
import logging
import os
import sys
@@ -115,19 +117,19 @@ if not DISABLE_FILE_LOG:
file_log_config["diagnose"] = False
# 主日志文件 - 所有级别
logger.add(
logger.add( # type: ignore[call-overload]
log_dir / "app.log",
level="DEBUG",
**file_log_config, # type: ignore[arg-type]
**file_log_config,
)
# 错误日志文件 - 仅 ERROR 及以上
error_log_config = file_log_config.copy()
error_log_config["rotation"] = "50 MB"
logger.add(
logger.add( # type: ignore[call-overload]
log_dir / "error.log",
level="ERROR",
**error_log_config, # type: ignore[arg-type]
**error_log_config,
)
# ============================================================================