refactor: 统一使用现代类型注解替代传统类型注解

- 将 Dict、List 等传统类型注解替换为 dict、list 等现代类型注解
- 更新类型注解以更精确地反映变量类型
- 修复部分类型注解与实际使用不匹配的问题
- 优化部分代码逻辑以提高类型安全性
This commit is contained in:
Yuyao Huang (Sam)
2026-03-28 14:27:21 +08:00
parent 64297e5e27
commit 09b63341cd
13 changed files with 72 additions and 55 deletions
+3 -3
View File
@@ -16,9 +16,9 @@ class RegisterMessage:
"""Host client -> Router: Register this node."""
type: str = "register"
node_id: str = ""
serves_users: List[str] = field(default_factory=list)
serves_users: list[str] = field(default_factory=list)
working_dir: str = ""
capabilities: List[str] = field(default_factory=list)
capabilities: list[str] = field(default_factory=list)
display_name: str = ""
@@ -63,7 +63,7 @@ class NodeStatus:
type: str = "node_status"
node_id: str = ""
sessions: int = 0
active_sessions: List[Dict[str, Any]] = field(default_factory=list)
active_sessions: list[dict[str, Any]] = field(default_factory=list)
MESSAGE_TYPES = {