fix: 修复flake8 lint检查错误
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
- 删除废弃的 admin_positions_backup.py 备份文件 - 修复 courses.py 缺失的 select 导入 - 修复 coze_gateway.py 异常变量作用域问题 - 修复 scheduler_service.py 无用的 global 声明 - 添加 TYPE_CHECKING 导入解决模型前向引用警告
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
课程相关数据库模型
|
||||
"""
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
from typing import List, Optional, TYPE_CHECKING
|
||||
from datetime import datetime
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from app.models.growth_path import GrowthPathNode
|
||||
|
||||
from sqlalchemy import (
|
||||
String,
|
||||
Text,
|
||||
|
||||
@@ -2,10 +2,14 @@
|
||||
成长路径相关数据库模型
|
||||
"""
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
from typing import List, Optional, TYPE_CHECKING
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from app.models.course import Course
|
||||
from app.models.user import User
|
||||
|
||||
from sqlalchemy import (
|
||||
String,
|
||||
Text,
|
||||
@@ -84,7 +88,7 @@ class GrowthPathNode(BaseModel, SoftDeleteMixin):
|
||||
)
|
||||
|
||||
# 关联关系
|
||||
growth_path: Mapped["GrowthPath"] = relationship(
|
||||
growth_path: Mapped["GrowthPath"] = relationship( # noqa: F821
|
||||
"GrowthPath", back_populates="nodes"
|
||||
)
|
||||
course: Mapped["Course"] = relationship("Course")
|
||||
@@ -146,7 +150,7 @@ class UserGrowthPathProgress(BaseModel):
|
||||
|
||||
# 关联关系
|
||||
user: Mapped["User"] = relationship("User")
|
||||
growth_path: Mapped["GrowthPath"] = relationship("GrowthPath")
|
||||
growth_path: Mapped["GrowthPath"] = relationship("GrowthPath") # noqa: F821
|
||||
|
||||
|
||||
class UserNodeCompletion(BaseModel):
|
||||
@@ -203,4 +207,4 @@ class UserNodeCompletion(BaseModel):
|
||||
node: Mapped["GrowthPathNode"] = relationship(
|
||||
"GrowthPathNode", back_populates="user_completions"
|
||||
)
|
||||
growth_path: Mapped["GrowthPath"] = relationship("GrowthPath")
|
||||
growth_path: Mapped["GrowthPath"] = relationship("GrowthPath") # noqa: F821
|
||||
|
||||
Reference in New Issue
Block a user