ruff fix但指定了--unsafe-fixes

This commit is contained in:
minecraft1024a
2025-10-05 21:48:32 +08:00
parent 0b4e1f5b7b
commit 9d705463ce
76 changed files with 300 additions and 315 deletions

View File

@@ -31,30 +31,30 @@ from .config_types import ConfigField
from .plus_command import PlusCommand, PlusCommandAdapter, create_plus_command_adapter
__all__ = [
"BasePlugin",
"ActionActivationType",
"ActionInfo",
"BaseAction",
"BaseCommand",
"BaseEventHandler",
"BasePlugin",
"BaseTool",
"ComponentType",
"ActionActivationType",
"ChatMode",
"ChatType",
"ComponentInfo",
"ActionInfo",
"CommandArgs",
"CommandInfo",
"PlusCommandInfo",
"ToolInfo",
"PluginInfo",
"PythonDependency",
"ComponentInfo",
"ComponentType",
"ConfigField",
"EventHandlerInfo",
"EventType",
"BaseEventHandler",
"MaiMessages",
"ToolParamType",
"PluginInfo",
# 增强命令系统
"PlusCommand",
"CommandArgs",
"PlusCommandAdapter",
"PlusCommandInfo",
"PythonDependency",
"ToolInfo",
"ToolParamType",
"create_plus_command_adapter",
]

View File

@@ -525,7 +525,7 @@ class BaseAction(ABC):
selected_action = self.action_data.get("selected_action")
if not selected_action:
# 第一步展示可用的子Action
available_actions = [sub_action[0] for sub_action in self.sub_actions]
[sub_action[0] for sub_action in self.sub_actions]
description = self.step_one_description or f"{self.action_name}支持以下操作"
actions_list = "\n".join([f"- {action}: {desc}" for action, desc, _ in self.sub_actions])

View File

@@ -86,7 +86,7 @@ class HandlerResultsCollection:
class BaseEvent:
def __init__(self, name: str, allowed_subscribers: list[str] = None, allowed_triggers: list[str] = None):
def __init__(self, name: str, allowed_subscribers: list[str] | None = None, allowed_triggers: list[str] | None = None):
self.name = name
self.enabled = True
self.allowed_subscribers = allowed_subscribers # 记录事件处理器名

View File

@@ -316,7 +316,7 @@ class PlusCommand(ABC):
str: 正则表达式字符串
"""
# 获取所有可能的命令名(主命令名 + 别名)
all_commands = [cls.command_name] + getattr(cls, "command_aliases", [])
all_commands = [cls.command_name, *getattr(cls, "command_aliases", [])]
# 转义特殊字符并创建选择组
escaped_commands = [re.escape(cmd) for cmd in all_commands]