refactor(core): 优化类型提示与代码风格
本次提交对项目代码进行了广泛的重构,主要集中在以下几个方面:
1. **类型提示现代化**:
- 将 `typing` 模块中的 `Optional[T]`、`List[T]`、`Dict[K, V]` 等旧式类型提示更新为现代的 `T | None`、`list[T]`、`dict[K, V]` 语法。
- 这提高了代码的可读性,并与较新 Python 版本的风格保持一致。
2. **代码风格统一**:
- 移除了多余的空行和不必要的空格,使代码更加紧凑和规范。
- 统一了部分日志输出的格式,增强了日志的可读性。
3. **导入语句优化**:
- 调整了部分模块的 `import` 语句顺序,使其符合 PEP 8 规范。
这些更改不涉及任何功能性变动,旨在提升代码库的整体质量、可维护性和开发体验。
This commit is contained in:
@@ -192,7 +192,7 @@ class BaseAction(ABC):
|
||||
self.group_name = self.action_message.get("chat_info_group_name", None)
|
||||
self.user_id = str(self.action_message.get("user_id", None))
|
||||
self.user_nickname = self.action_message.get("user_nickname", None)
|
||||
|
||||
|
||||
if self.group_id:
|
||||
self.is_group = True
|
||||
self.target_id = self.group_id
|
||||
|
||||
@@ -45,7 +45,7 @@ class BaseCommand(ABC):
|
||||
self.plugin_config = plugin_config or {} # 直接存储插件配置字典
|
||||
|
||||
self.log_prefix = "[Command]"
|
||||
|
||||
|
||||
# chat_stream 会在运行时被 bot.py 设置
|
||||
self.chat_stream: "ChatStream | None" = None
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class PlusCommand(ABC):
|
||||
self.message = message
|
||||
self.plugin_config = plugin_config or {}
|
||||
self.log_prefix = "[PlusCommand]"
|
||||
|
||||
|
||||
# chat_stream 会在运行时被 bot.py 设置
|
||||
self.chat_stream: "ChatStream | None" = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user