Skip to content

Commit 3e8679b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e8a59f8 commit 3e8679b

28 files changed

+57
-67
lines changed

Diff for: docs/gen_ref.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Generate the code reference pages and navigation."""
2+
23
import sys
34
from pathlib import Path
45

Diff for: src/graia/ariadne/connection/config.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ class ConfigTypedDict(TypedDict):
8787

8888

8989
@overload
90-
def from_obj(obj: Sequence[ConfigTypedDict]) -> List["Ariadne"]:
91-
...
90+
def from_obj(obj: Sequence[ConfigTypedDict]) -> List["Ariadne"]: ...
9291

9392

9493
@overload
95-
def from_obj(obj: ConfigTypedDict) -> "Ariadne":
96-
...
94+
def from_obj(obj: ConfigTypedDict) -> "Ariadne": ...
9795

9896

9997
def from_obj(obj: Union[ConfigTypedDict, Sequence[ConfigTypedDict]]) -> Union[List["Ariadne"], "Ariadne"]:

Diff for: src/graia/ariadne/connection/util.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@
4242

4343

4444
@overload
45-
def validate_response(data: Any, raising: Literal[False]) -> Any | Exception:
46-
...
45+
def validate_response(data: Any, raising: Literal[False]) -> Any | Exception: ...
4746

4847

4948
@overload
50-
def validate_response(data: Any, raising: Literal[True] = True) -> Any:
51-
...
49+
def validate_response(data: Any, raising: Literal[True] = True) -> Any: ...
5250

5351

5452
def validate_response(data: Any, raising: bool = True):

Diff for: src/graia/ariadne/console/saya.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne 控制台对 Saya 封装的 Behaviour 与 Schema"""
2+
23
from dataclasses import dataclass, field
34
from typing import Callable, List
45

Diff for: src/graia/ariadne/context.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""本模块创建了 Ariadne 中的上下文变量"""
2+
23
from __future__ import annotations
34

45
from contextlib import contextmanager, suppress

Diff for: src/graia/ariadne/entry/message.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Ariadne 消息相关的导入集合"""
22

3-
43
from ..message import Quote as Quote
54
from ..message import Source as Source
65
from ..message.chain import MessageChain as MessageChain

Diff for: src/graia/ariadne/event/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne 的事件"""
2+
23
from graia.broadcast import Dispatchable
34

45
from ..dispatcher import BaseDispatcher

Diff for: src/graia/ariadne/event/lifecycle.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne, Adapter 生命周期相关事件"""
2+
23
import typing
34

45
from graia.broadcast.entities.event import Dispatchable

Diff for: src/graia/ariadne/event/message.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne 消息事件"""
2+
23
from typing import Any, Dict, List, Optional, Union
34

45
from pydantic import Field, root_validator

Diff for: src/graia/ariadne/message/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""本模块提供 Ariadne 消息相关部件."""
2+
23
from datetime import datetime
34
from typing import TYPE_CHECKING
45

Diff for: src/graia/ariadne/message/chain.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne 消息链的实现"""
2+
23
import re
34
from copy import deepcopy
45
from typing import (
@@ -109,12 +110,10 @@ def parse_obj(cls: Type[Self], obj: Union[List[dict], List[Element]]) -> Self:
109110
return cls(cls.build_chain(obj), inline=True)
110111

111112
@overload
112-
def __init__(self, __root__: Sequence[Element], *, inline: Literal[True]) -> None:
113-
...
113+
def __init__(self, __root__: Sequence[Element], *, inline: Literal[True]) -> None: ...
114114

115115
@overload
116-
def __init__(self, *elements: MessageContainer, inline: Literal[False] = False) -> None:
117-
...
116+
def __init__(self, *elements: MessageContainer, inline: Literal[False] = False) -> None: ...
118117

119118
def __init__(
120119
self,
@@ -146,20 +145,16 @@ def __repr_args__(self) -> "ReprArgs":
146145
return [(None, list(self.content))]
147146

148147
@overload
149-
def __getitem__(self, item: Tuple[Type[Element_T], int]) -> List[Element_T]:
150-
...
148+
def __getitem__(self, item: Tuple[Type[Element_T], int]) -> List[Element_T]: ...
151149

152150
@overload
153-
def __getitem__(self, item: Type[Element_T]) -> List[Element_T]:
154-
...
151+
def __getitem__(self, item: Type[Element_T]) -> List[Element_T]: ...
155152

156153
@overload
157-
def __getitem__(self, item: int) -> Element:
158-
...
154+
def __getitem__(self, item: int) -> Element: ...
159155

160156
@overload
161-
def __getitem__(self, item: slice) -> Self:
162-
...
157+
def __getitem__(self, item: slice) -> Self: ...
163158

164159
def __getitem__(self, item: Union[Tuple[Type[Element], int], Type[Element], int, slice]) -> Any:
165160
"""

Diff for: src/graia/ariadne/message/commander/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Commander: 便捷的指令触发体系"""
2+
23
import abc
34
import asyncio
45
import contextlib

Diff for: src/graia/ariadne/message/element.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne 中的消息元素"""
2+
23
from base64 import b64decode, b64encode
34
from datetime import datetime
45
from enum import Enum
@@ -563,12 +564,10 @@ def parse_obj(cls, obj: Any) -> Self:
563564
return cls(**obj)
564565

565566
@overload
566-
def __getitem__(self, key: int) -> ForwardNode:
567-
...
567+
def __getitem__(self, key: int) -> ForwardNode: ...
568568

569569
@overload
570-
def __getitem__(self, key: slice) -> List[ForwardNode]:
571-
...
570+
def __getitem__(self, key: slice) -> List[ForwardNode]: ...
572571

573572
def __getitem__(self, key: Union[int, slice]) -> Union[ForwardNode, List[ForwardNode]]:
574573
return self.node_list[key]

Diff for: src/graia/ariadne/message/formatter.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""基于 format string 的消息链格式化器"""
2+
23
from __future__ import annotations
34

45
import string

Diff for: src/graia/ariadne/message/parser/base.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne 基础的 parser, 包括 DetectPrefix 与 DetectSuffix"""
2+
23
import abc
34
import difflib
45
import fnmatch
@@ -26,8 +27,9 @@ class ChainDecorator(abc.ABC, Decorator, Derive[MessageChain]):
2627
pre = True
2728

2829
@abc.abstractmethod
29-
async def __call__(self, chain: MessageChain, interface: DispatcherInterface) -> Optional[MessageChain]:
30-
...
30+
async def __call__(
31+
self, chain: MessageChain, interface: DispatcherInterface
32+
) -> Optional[MessageChain]: ...
3133

3234
async def target(self, interface: DecoratorInterface):
3335
return await self(

Diff for: src/graia/ariadne/message/parser/twilight.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Twilight: 混合式消息链处理器"""
2+
23
import abc
34
import contextlib
45
import enum
@@ -443,16 +444,13 @@ def __init__(self, match_result: Dict[Union[int, str], MatchResult]):
443444
self.res = match_result
444445

445446
@overload
446-
def __getitem__(self, item: Union[int, str]) -> MatchResult:
447-
...
447+
def __getitem__(self, item: Union[int, str]) -> MatchResult: ...
448448

449449
@overload
450-
def __getitem__(self, item: Type[int]) -> List[MatchResult]:
451-
...
450+
def __getitem__(self, item: Type[int]) -> List[MatchResult]: ...
452451

453452
@overload
454-
def __getitem__(self, item: Type[str]) -> Dict[str, MatchResult]:
455-
...
453+
def __getitem__(self, item: Type[str]) -> Dict[str, MatchResult]: ...
456454

457455
def __getitem__(self, item: Union[int, str, Type[int], Type[str]]):
458456
if not isinstance(item, type):

Diff for: src/graia/ariadne/message/parser/util.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""消息链处理器用到的工具函数, 类"""
2+
23
import argparse
34
import inspect
45
import re
@@ -225,8 +226,7 @@ def get_help(
225226
*,
226227
prefix_src: Literal["brief", "usage", "description"] = "brief",
227228
fmt_cls: Type[argparse.HelpFormatter] = argparse.HelpFormatter,
228-
) -> str:
229-
...
229+
) -> str: ...
230230

231231
@overload
232232
def get_help(
@@ -237,8 +237,7 @@ def get_help(
237237
prefix_src: Literal["brief", "usage", "description"] = "brief",
238238
fmt_func: Callable[[str], T],
239239
fmt_cls: Type[argparse.HelpFormatter] = argparse.HelpFormatter,
240-
) -> T:
241-
...
240+
) -> T: ...
242241

243242
def get_help(
244243
self,

Diff for: src/graia/ariadne/model/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne 各种 model 存放的位置"""
2+
23
import functools
34
from datetime import datetime
45
from typing import TYPE_CHECKING, Awaitable, Callable, Dict, Literal, Optional, Type, Union

Diff for: src/graia/ariadne/model/util.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""用于 Ariadne 数据模型的工具类."""
2+
23
from datetime import datetime
34
from typing import TYPE_CHECKING, Any, Literal, Union
45
from typing_extensions import NotRequired, TypedDict

Diff for: src/graia/ariadne/service.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Ariadne 的 launart 服务相关"""
2+
23
import asyncio
34
import importlib.metadata
45
import json
@@ -246,12 +247,10 @@ def loop(self) -> asyncio.AbstractEventLoop:
246247
return it(asyncio.AbstractEventLoop)
247248

248249
@overload
249-
def get_interface(self, interface_type: Type[ConnectionInterface]) -> ConnectionInterface:
250-
...
250+
def get_interface(self, interface_type: Type[ConnectionInterface]) -> ConnectionInterface: ...
251251

252252
@overload
253-
def get_interface(self, interface_type: type) -> None:
254-
...
253+
def get_interface(self, interface_type: type) -> None: ...
255254

256255
def get_interface(self, interface_type: type):
257256
if interface_type is ConnectionInterface:

Diff for: src/graia/ariadne/typing.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Ariadne 的类型标注"""
22

3-
43
import contextlib
54
import enum
65
import sys
@@ -116,14 +115,11 @@ async def exception(item: SendMessageException) -> Optional[T]:
116115

117116
@runtime_checkable
118117
class SendMessageActionProtocol(Protocol[T_co]):
119-
async def param(self, item: SendMessageDict) -> SendMessageDict:
120-
...
118+
async def param(self, item: SendMessageDict) -> SendMessageDict: ...
121119

122-
async def result(self, item: "ActiveMessage") -> T_co:
123-
...
120+
async def result(self, item: "ActiveMessage") -> T_co: ...
124121

125-
async def exception(self, item: SendMessageException) -> Any:
126-
...
122+
async def exception(self, item: SendMessageException) -> Any: ...
127123

128124

129125
def generic_issubclass(cls: Any, par: Union[type, Any, Tuple[type, ...]]) -> bool:

Diff for: src/graia/ariadne/util/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""本模块提供 Ariadne 内部使用的小工具, 以及方便的辅助模块."""
22

3-
43
# Utility Layout
54
import functools
65
import inspect

Diff for: src/graia/ariadne/util/async_exec.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
提示: 若需要代替, 建议使用 `unsync` 库.
44
"""
5+
56
import asyncio
67
import functools
78
import importlib

Diff for: src/graia/ariadne/util/cooldown.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ async def afterDispatch(
168168

169169
@overload
170170
@contextlib.asynccontextmanager
171-
async def trigger(self, target: int) -> AsyncGenerator[Tuple[Optional[datetime], bool], None]:
172-
...
171+
async def trigger(self, target: int) -> AsyncGenerator[Tuple[Optional[datetime], bool], None]: ...
173172

174173
@overload
175174
@contextlib.asynccontextmanager
176-
async def trigger(self, target: int, type: Type[T_Time]) -> AsyncGenerator[Tuple[T_Time, bool], None]:
177-
...
175+
async def trigger(
176+
self, target: int, type: Type[T_Time]
177+
) -> AsyncGenerator[Tuple[T_Time, bool], None]: ...
178178

179179
@contextlib.asynccontextmanager
180180
async def trigger(

Diff for: src/graia/ariadne/util/interrupt.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Broadcast Interrupt 相关的工具"""
2+
23
import asyncio
34
from typing import Awaitable, Callable, Generic, List, Optional, Type, TypeVar, cast
45
from typing_extensions import overload
@@ -37,16 +38,13 @@ def __init__(
3738
self.block_propagation = block_propagation
3839

3940
@overload
40-
async def wait(self, timeout: float, default: T) -> T:
41-
...
41+
async def wait(self, timeout: float, default: T) -> T: ...
4242

4343
@overload
44-
async def wait(self, timeout: float, default: Optional[T] = None) -> Optional[T]:
45-
...
44+
async def wait(self, timeout: float, default: Optional[T] = None) -> Optional[T]: ...
4645

4746
@overload
48-
async def wait(self, timeout: None = None) -> T:
49-
...
47+
async def wait(self, timeout: None = None) -> T: ...
5048

5149
async def wait(self, timeout: Optional[float] = None, default: Optional[T] = None):
5250
"""等待 Waiter, 如果超时则返回默认值

Diff for: src/graia/ariadne/util/saya.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Saya 相关的工具"""
2+
23
from __future__ import annotations
34

45
import inspect

Diff for: src/graia/ariadne/util/send.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""本模块包含许多用于 Ariadne.SendMessage 的 action 函数"""
2+
23
from typing import Optional, TypeVar, Union, overload
34

45
from ..app import Ariadne
@@ -61,12 +62,10 @@ def __init__(self, ignore: bool = False) -> None:
6162

6263
@overload
6364
@staticmethod
64-
async def exception(item) -> ActiveMessage:
65-
...
65+
async def exception(item) -> ActiveMessage: ...
6666

6767
@overload
68-
async def exception(self, item) -> ActiveMessage:
69-
...
68+
async def exception(self, item) -> ActiveMessage: ...
7069

7170
@staticmethod
7271
async def _handle(item: SendMessageException, ignore: bool):

Diff for: src/test_old/commander_performance.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ async def m():
2222
for _ in range(handles):
2323

2424
@cmd.command(".test foo bar fox mop {v}")
25-
def _(v: At):
26-
...
25+
def _(v: At): ...
2726

2827
async def disp(entry, dispatchers):
2928
debug(dispatchers[0].data)
@@ -34,8 +33,7 @@ async def disp(entry, dispatchers):
3433

3534
await cmd.execute(msg)
3635

37-
async def a(*args, **kwargs):
38-
...
36+
async def a(*args, **kwargs): ...
3937

4038
cmd.broadcast.Executor = a
4139

0 commit comments

Comments
 (0)