mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
fix: 添加 from __future__ import annotations 修复运行时类型错误
原 PR 将 Optional[X] 改为 X | None 后,如果 X 在 TYPE_CHECKING 块中导入, 会导致运行时 NameError。添加 future annotations 使类型注解延迟求值。 影响文件: - src/services/auth/service.py - src/core/api_format/utils.py - src/core/api_format/detection.py - 及其他 15 个使用 TYPE_CHECKING 的文件
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
- data_format_id 不同 -> 需要转换,检查全局开关 + 端点配置 + 转换器能力
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
@@ -4,6 +4,8 @@ API 格式检测
|
||||
提供从请求头、响应内容等检测 API 格式的函数。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ API 格式工具函数
|
||||
提供格式判断、规范化等工具函数,供整个项目使用。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
包含模块元数据、定义和状态的数据结构
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
Reference in New Issue
Block a user