Skip to content

Commit b0b7175

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

File tree

13 files changed

+36
-64
lines changed

13 files changed

+36
-64
lines changed

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/message/chain.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,10 @@ def parse_obj(cls: Type[Self], obj: Union[List[dict], List[Element]]) -> Self:
109109
return cls(cls.build_chain(obj), inline=True)
110110

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

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

119117
def __init__(
120118
self,
@@ -146,20 +144,16 @@ def __repr_args__(self) -> "ReprArgs":
146144
return [(None, list(self.content))]
147145

148146
@overload
149-
def __getitem__(self, item: Tuple[Type[Element_T], int]) -> List[Element_T]:
150-
...
147+
def __getitem__(self, item: Tuple[Type[Element_T], int]) -> List[Element_T]: ...
151148

152149
@overload
153-
def __getitem__(self, item: Type[Element_T]) -> List[Element_T]:
154-
...
150+
def __getitem__(self, item: Type[Element_T]) -> List[Element_T]: ...
155151

156152
@overload
157-
def __getitem__(self, item: int) -> Element:
158-
...
153+
def __getitem__(self, item: int) -> Element: ...
159154

160155
@overload
161-
def __getitem__(self, item: slice) -> Self:
162-
...
156+
def __getitem__(self, item: slice) -> Self: ...
163157

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

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -563,12 +563,10 @@ def parse_obj(cls, obj: Any) -> Self:
563563
return cls(**obj)
564564

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

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

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

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ class ChainDecorator(abc.ABC, Decorator, Derive[MessageChain]):
2626
pre = True
2727

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

3233
async def target(self, interface: DecoratorInterface):
3334
return await self(

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,13 @@ def __init__(self, match_result: Dict[Union[int, str], MatchResult]):
443443
self.res = match_result
444444

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

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

453451
@overload
454-
def __getitem__(self, item: Type[str]) -> Dict[str, MatchResult]:
455-
...
452+
def __getitem__(self, item: Type[str]) -> Dict[str, MatchResult]: ...
456453

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

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ def get_help(
225225
*,
226226
prefix_src: Literal["brief", "usage", "description"] = "brief",
227227
fmt_cls: Type[argparse.HelpFormatter] = argparse.HelpFormatter,
228-
) -> str:
229-
...
228+
) -> str: ...
230229

231230
@overload
232231
def get_help(
@@ -237,8 +236,7 @@ def get_help(
237236
prefix_src: Literal["brief", "usage", "description"] = "brief",
238237
fmt_func: Callable[[str], T],
239238
fmt_cls: Type[argparse.HelpFormatter] = argparse.HelpFormatter,
240-
) -> T:
241-
...
239+
) -> T: ...
242240

243241
def get_help(
244242
self,

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,10 @@ def loop(self) -> asyncio.AbstractEventLoop:
246246
return it(asyncio.AbstractEventLoop)
247247

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

252251
@overload
253-
def get_interface(self, interface_type: type) -> None:
254-
...
252+
def get_interface(self, interface_type: type) -> None: ...
255253

256254
def get_interface(self, interface_type: type):
257255
if interface_type is ConnectionInterface:

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,11 @@ async def exception(item: SendMessageException) -> Optional[T]:
116116

117117
@runtime_checkable
118118
class SendMessageActionProtocol(Protocol[T_co]):
119-
async def param(self, item: SendMessageDict) -> SendMessageDict:
120-
...
119+
async def param(self, item: SendMessageDict) -> SendMessageDict: ...
121120

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

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

128125

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

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@ def __init__(
3737
self.block_propagation = block_propagation
3838

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

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

4745
@overload
48-
async def wait(self, timeout: None = None) -> T:
49-
...
46+
async def wait(self, timeout: None = None) -> T: ...
5047

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

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,10 @@ def __init__(self, ignore: bool = False) -> None:
6161

6262
@overload
6363
@staticmethod
64-
async def exception(item) -> ActiveMessage:
65-
...
64+
async def exception(item) -> ActiveMessage: ...
6665

6766
@overload
68-
async def exception(self, item) -> ActiveMessage:
69-
...
67+
async def exception(self, item) -> ActiveMessage: ...
7068

7169
@staticmethod
7270
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)