Skip to content

Commit f631728

Browse files
authored
style: 更新 Ruff 并重新格式化 (#160)
1 parent d535f65 commit f631728

File tree

18 files changed

+44
-42
lines changed

18 files changed

+44
-42
lines changed

alicebot/adapter/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
from alicebot.typing import ConfigT, EventT
1818

1919
__all__ = [
20-
"PollingAdapter",
2120
"HttpClientAdapter",
22-
"WebSocketClientAdapter",
2321
"HttpServerAdapter",
24-
"WebSocketServerAdapter",
22+
"PollingAdapter",
2523
"WebSocketAdapter",
24+
"WebSocketClientAdapter",
25+
"WebSocketServerAdapter",
2626
]
2727

2828
logger = structlog.stdlib.get_logger()

alicebot/bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ def _load_plugins_from_module_name(
709709
else:
710710
for plugin_class, module in plugin_classes:
711711
self._load_plugin_class(
712-
plugin_class, # type: ignore
712+
plugin_class, # type: ignore[type-abstract]
713713
plugin_load_type,
714714
module.__file__,
715715
)

alicebot/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
from pydantic import BaseModel, ConfigDict, DirectoryPath, Field
99

1010
__all__ = [
11+
"AdapterConfig",
12+
"BotConfig",
1113
"ConfigModel",
1214
"LogConfig",
13-
"BotConfig",
14-
"PluginConfig",
15-
"AdapterConfig",
1615
"MainConfig",
16+
"PluginConfig",
1717
]
1818

1919

alicebot/exceptions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"""
66

77
__all__ = [
8-
"EventException",
9-
"SkipException",
10-
"StopException",
8+
"AdapterException",
119
"AliceBotException",
10+
"EventException",
1211
"GetEventTimeout",
13-
"AdapterException",
1412
"LoadModuleError",
13+
"SkipException",
14+
"StopException",
1515
]
1616

1717

alicebot/message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
from pydantic_core import core_schema
2323

2424
__all__ = [
25-
"MessageT",
26-
"MessageSegmentT",
2725
"BuildMessageType",
2826
"Message",
2927
"MessageSegment",
28+
"MessageSegmentT",
29+
"MessageT",
3030
]
3131

3232
MessageT = TypeVar("MessageT", bound="Message[Any]")

alicebot/typing.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
此模块定义了部分 AliceBot 使用的类型。
44
"""
55

6+
# ruff: noqa: A005
7+
68
from collections.abc import Awaitable
79
from typing import TYPE_CHECKING, Callable, Optional, TypeVar
810

@@ -18,17 +20,17 @@
1820
from alicebot.plugin import Plugin
1921

2022
__all__ = [
21-
"StateT",
22-
"EventT",
23-
"PluginT",
23+
"AdapterHook",
2424
"AdapterT",
25-
"ConfigT",
26-
"MessageT",
27-
"MessageSegmentT",
28-
"BuildMessageType",
2925
"BotHook",
30-
"AdapterHook",
26+
"BuildMessageType",
27+
"ConfigT",
3128
"EventHook",
29+
"EventT",
30+
"MessageSegmentT",
31+
"MessageT",
32+
"PluginT",
33+
"StateT",
3234
]
3335

3436
StateT = TypeVar("StateT")

alicebot/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@
4141

4242
__all__ = [
4343
"ModulePathFinder",
44-
"is_config_class",
44+
"PydanticEncoder",
45+
"get_annotations",
4546
"get_classes_from_module",
4647
"get_classes_from_module_name",
47-
"PydanticEncoder",
48+
"is_config_class",
4849
"samefile",
49-
"sync_func_wrapper",
5050
"sync_ctx_manager_wrapper",
51+
"sync_func_wrapper",
5152
"wrap_get_func",
52-
"get_annotations",
5353
]
5454

5555
_T = TypeVar("_T")

examples/plugins/global_state_test1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ async def handle(self) -> None:
66
if self.bot.global_state.get("count") is None:
77
self.bot.global_state["count"] = 0
88
self.bot.global_state["count"] += 1
9-
await self.event.reply(f'add: {self.bot.global_state["count"]}')
9+
await self.event.reply(f"add: {self.bot.global_state['count']}")
1010

1111
async def rule(self) -> bool:
1212
if self.event.adapter.name != "cqhttp":

examples/plugins/global_state_test2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ async def handle(self) -> None:
66
if self.bot.global_state.get("count") is None:
77
self.bot.global_state["count"] = 0
88
self.bot.global_state["count"] -= 1
9-
await self.event.reply(f'sub: {self.bot.global_state["count"]}')
9+
await self.event.reply(f"sub: {self.bot.global_state['count']}")
1010

1111
async def rule(self) -> bool:
1212
if self.event.adapter.name != "cqhttp":

packages/alicebot-adapter-cqhttp/alicebot/adapter/cqhttp/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from alicebot.exceptions import AdapterException
66

77
__all__ = [
8-
"CQHTTPException",
9-
"NetworkError",
108
"ActionFailed",
119
"ApiNotAvailable",
1210
"ApiTimeout",
11+
"CQHTTPException",
12+
"NetworkError",
1313
]
1414

1515

0 commit comments

Comments
 (0)