chore: 升级到 Python 3.14 并现代化代码

- 升级 Docker 基础镜像从 Python 3.12 到 3.14
- 更新 pyproject.toml 支持 Python 3.13/3.14
- 移除 Python 3.8/3.9/3.10/3.11 分类器
- 更新 black 和 mypy 配置目标版本
- 将 get_event_loop() 替换为 get_running_loop() 加上 RuntimeError 处理
- 简化 compute_cost_sync 中的 asyncio.run 使用
- Dict/List/Tuple/Set → dict/list/tuple/set (PEP 585)
- Optional[T] → T | None (PEP 604)
- Union[A, B] → A | B (PEP 604)
- 移除废弃的 typing 导入
- 移除不必要的字符串引号注解
This commit is contained in:
AAEE86
2026-01-30 03:10:21 +08:00
parent 3e75bc8964
commit 24d24f6829
255 changed files with 4062 additions and 4173 deletions

View File

@@ -4,8 +4,6 @@
所有可选功能模块在此注册
"""
from typing import List
from src.core.modules.base import ModuleDefinition
# 导入所有模块定义
@@ -13,7 +11,7 @@ from src.modules.ldap import ldap_module
from src.modules.oauth import oauth_module
# 所有模块列表
ALL_MODULES: List[ModuleDefinition] = [
ALL_MODULES: list[ModuleDefinition] = [
ldap_module,
oauth_module,
]

View File

@@ -4,7 +4,7 @@ LDAP 认证模块
提供 LDAP/Active Directory 用户认证支持
"""
from typing import TYPE_CHECKING, Tuple
from typing import TYPE_CHECKING
from src.core.modules.base import (
ModuleCategory,
@@ -31,7 +31,7 @@ async def _health_check() -> ModuleHealth:
return ModuleHealth.UNKNOWN
def _validate_config(db: "Session") -> Tuple[bool, str]:
def _validate_config(db: Session) -> tuple[bool, str]:
"""
验证 LDAP 配置是否可以启用模块

View File

@@ -4,7 +4,7 @@ OAuth 认证模块
提供可配置的 OAuth 登录/绑定能力。
"""
from typing import TYPE_CHECKING, Tuple
from typing import TYPE_CHECKING
from src.core.modules.base import (
ModuleCategory,
@@ -34,7 +34,7 @@ async def _health_check() -> ModuleHealth:
return ModuleHealth.UNKNOWN
def _validate_config(db: "Session") -> Tuple[bool, str]:
def _validate_config(db: Session) -> tuple[bool, str]:
"""
验证 OAuth 配置是否可以启用模块