mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-18 02:00:09 +08:00
style: apply ruff unsafe-fixes and format
This commit is contained in:
@@ -39,7 +39,7 @@ class NeoPythonComponent(PythonComponent):
|
||||
self,
|
||||
code: str,
|
||||
kernel_id: str | None = None,
|
||||
timeout: int = 30, # noqa: ASYNC109
|
||||
timeout: int = 30,
|
||||
silent: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
_ = kernel_id # Bay runtime does not expose kernel_id in current SDK.
|
||||
@@ -81,7 +81,7 @@ class NeoShellComponent(ShellComponent):
|
||||
command: str,
|
||||
cwd: str | None = None,
|
||||
env: dict[str, str] | None = None,
|
||||
timeout: int | None = 30, # noqa: ASYNC109
|
||||
timeout: int | None = 30,
|
||||
shell: bool = True,
|
||||
background: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
@@ -198,7 +198,7 @@ class NeoBrowserComponent(BrowserComponent):
|
||||
async def exec(
|
||||
self,
|
||||
cmd: str,
|
||||
timeout: int = 30, # noqa: ASYNC109
|
||||
timeout: int = 30,
|
||||
description: str | None = None,
|
||||
tags: str | None = None,
|
||||
learn: bool = False,
|
||||
@@ -217,7 +217,7 @@ class NeoBrowserComponent(BrowserComponent):
|
||||
async def exec_batch(
|
||||
self,
|
||||
commands: list[str],
|
||||
timeout: int = 60, # noqa: ASYNC109
|
||||
timeout: int = 60,
|
||||
stop_on_error: bool = True,
|
||||
description: str | None = None,
|
||||
tags: str | None = None,
|
||||
@@ -238,7 +238,7 @@ class NeoBrowserComponent(BrowserComponent):
|
||||
async def run_skill(
|
||||
self,
|
||||
skill_key: str,
|
||||
timeout: int = 60, # noqa: ASYNC109
|
||||
timeout: int = 60,
|
||||
stop_on_error: bool = True,
|
||||
include_trace: bool = False,
|
||||
description: str | None = None,
|
||||
|
||||
@@ -152,65 +152,65 @@ class PlatformManager:
|
||||
match platform_config["type"]:
|
||||
case "aiocqhttp":
|
||||
from .sources.aiocqhttp.aiocqhttp_platform_adapter import (
|
||||
AiocqhttpAdapter, # noqa: F401
|
||||
AiocqhttpAdapter,
|
||||
)
|
||||
case "qq_official":
|
||||
from .sources.qqofficial.qqofficial_platform_adapter import (
|
||||
QQOfficialPlatformAdapter, # noqa: F401
|
||||
QQOfficialPlatformAdapter,
|
||||
)
|
||||
case "qq_official_webhook":
|
||||
from .sources.qqofficial_webhook.qo_webhook_adapter import (
|
||||
QQOfficialWebhookPlatformAdapter, # noqa: F401
|
||||
QQOfficialWebhookPlatformAdapter,
|
||||
)
|
||||
case "lark":
|
||||
from .sources.lark.lark_adapter import (
|
||||
LarkPlatformAdapter, # noqa: F401
|
||||
LarkPlatformAdapter,
|
||||
)
|
||||
case "dingtalk":
|
||||
from .sources.dingtalk.dingtalk_adapter import (
|
||||
DingtalkPlatformAdapter, # noqa: F401
|
||||
DingtalkPlatformAdapter,
|
||||
)
|
||||
case "telegram":
|
||||
from .sources.telegram.tg_adapter import (
|
||||
TelegramPlatformAdapter, # noqa: F401
|
||||
TelegramPlatformAdapter,
|
||||
)
|
||||
case "wecom":
|
||||
from .sources.wecom.wecom_adapter import (
|
||||
WecomPlatformAdapter, # noqa: F401
|
||||
WecomPlatformAdapter,
|
||||
)
|
||||
case "wecom_ai_bot":
|
||||
from .sources.wecom_ai_bot.wecomai_adapter import (
|
||||
WecomAIBotAdapter, # noqa: F401
|
||||
WecomAIBotAdapter,
|
||||
)
|
||||
case "weixin_official_account":
|
||||
from .sources.weixin_official_account.weixin_offacc_adapter import (
|
||||
WeixinOfficialAccountPlatformAdapter, # noqa: F401
|
||||
WeixinOfficialAccountPlatformAdapter,
|
||||
)
|
||||
case "discord":
|
||||
from .sources.discord.discord_platform_adapter import (
|
||||
DiscordPlatformAdapter, # noqa: F401
|
||||
DiscordPlatformAdapter,
|
||||
)
|
||||
case "misskey":
|
||||
from .sources.misskey.misskey_adapter import (
|
||||
MisskeyPlatformAdapter, # noqa: F401
|
||||
MisskeyPlatformAdapter,
|
||||
)
|
||||
case "weixin_oc":
|
||||
from .sources.weixin_oc.weixin_oc_adapter import (
|
||||
WeixinOCAdapter, # noqa: F401
|
||||
WeixinOCAdapter,
|
||||
)
|
||||
case "slack":
|
||||
from .sources.slack.slack_adapter import SlackAdapter # noqa: F401
|
||||
from .sources.slack.slack_adapter import SlackAdapter
|
||||
case "satori":
|
||||
from .sources.satori.satori_adapter import (
|
||||
SatoriPlatformAdapter, # noqa: F401
|
||||
SatoriPlatformAdapter,
|
||||
)
|
||||
case "line":
|
||||
from .sources.line.line_adapter import (
|
||||
LinePlatformAdapter, # noqa: F401
|
||||
LinePlatformAdapter,
|
||||
)
|
||||
case "kook":
|
||||
from .sources.kook.kook_adapter import (
|
||||
KookPlatformAdapter, # noqa: F401
|
||||
KookPlatformAdapter,
|
||||
)
|
||||
except (ImportError, ModuleNotFoundError) as e:
|
||||
logger.error(
|
||||
|
||||
@@ -174,7 +174,7 @@ class TelegramPlatformAdapter(Platform):
|
||||
error_callback=self._on_polling_error
|
||||
)
|
||||
logger.info("Telegram Platform Adapter is running.")
|
||||
while self.application.updater.running and not self._terminating: # noqa: ASYNC110
|
||||
while self.application.updater.running and not self._terminating:
|
||||
await asyncio.sleep(1)
|
||||
|
||||
if not self._terminating:
|
||||
|
||||
@@ -28,7 +28,7 @@ PY_TO_JSON_TYPE = {
|
||||
}
|
||||
|
||||
# Re-export from _internal for backward compatibility
|
||||
# ruff: noqa: E402 - Constants above must be defined before this import
|
||||
|
||||
from astrbot._internal.tools.registry import (
|
||||
DEFAULT_MCP_CONFIG,
|
||||
ENABLE_MCP_TIMEOUT_ENV,
|
||||
|
||||
Reference in New Issue
Block a user