Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 1756d54

Browse files
🎨 Formatting with black once and for all
1 parent bd28f49 commit 1756d54

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1225
-726
lines changed

pincer/__init__.py

Lines changed: 105 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,51 @@
1414
from .cog import Cog
1515
from .commands import command, ChatCommandHandler
1616
from .exceptions import (
17-
PincerError, InvalidPayload, UnhandledException, NoExportMethod,
18-
CogError, CogNotFound, CogAlreadyExists, NoValidSetupMethod,
19-
TooManySetupArguments, NoCogManagerReturnFound, CommandError,
20-
CommandCooldownError, CommandIsNotCoroutine, CommandAlreadyRegistered,
21-
CommandDescriptionTooLong, TooManyArguments, InvalidArgumentAnnotation,
22-
CommandReturnIsEmpty, InvalidCommandGuild, InvalidCommandName,
23-
InvalidEventName, InvalidUrlError, EmbedFieldError, TaskError,
24-
TaskAlreadyRunning, TaskCancelError, TaskIsNotCoroutine, TaskInvalidDelay,
25-
DispatchError, DisallowedIntentsError, InvalidTokenError, HeartbeatError,
26-
UnavailableGuildError, HTTPError, NotModifiedError, BadRequestError,
27-
UnauthorizedError, ForbiddenError, NotFoundError, MethodNotAllowedError,
28-
RateLimitError, GatewayError, ServerError, EmbedOverflow, ImageEncodingError
17+
PincerError,
18+
InvalidPayload,
19+
UnhandledException,
20+
NoExportMethod,
21+
CogError,
22+
CogNotFound,
23+
CogAlreadyExists,
24+
NoValidSetupMethod,
25+
TooManySetupArguments,
26+
NoCogManagerReturnFound,
27+
CommandError,
28+
CommandCooldownError,
29+
CommandIsNotCoroutine,
30+
CommandAlreadyRegistered,
31+
CommandDescriptionTooLong,
32+
TooManyArguments,
33+
InvalidArgumentAnnotation,
34+
CommandReturnIsEmpty,
35+
InvalidCommandGuild,
36+
InvalidCommandName,
37+
InvalidEventName,
38+
InvalidUrlError,
39+
EmbedFieldError,
40+
TaskError,
41+
TaskAlreadyRunning,
42+
TaskCancelError,
43+
TaskIsNotCoroutine,
44+
TaskInvalidDelay,
45+
DispatchError,
46+
DisallowedIntentsError,
47+
InvalidTokenError,
48+
HeartbeatError,
49+
UnavailableGuildError,
50+
HTTPError,
51+
NotModifiedError,
52+
BadRequestError,
53+
UnauthorizedError,
54+
ForbiddenError,
55+
NotFoundError,
56+
MethodNotAllowedError,
57+
RateLimitError,
58+
GatewayError,
59+
ServerError,
60+
EmbedOverflow,
61+
ImageEncodingError,
2962
)
3063
from .objects import Intents
3164

@@ -51,29 +84,71 @@ class VersionInfo(NamedTuple):
5184

5285
def __repr__(self) -> str:
5386
return f"{self.major}.{self.minor}.{self.micro}" + (
54-
f"-{self.release_level}{self.serial}"
55-
* (self.release_level is not None)
87+
f"-{self.release_level}{self.serial}"
88+
* (self.release_level is not None)
5689
)
5790

5891

5992
version_info = VersionInfo(0, 16, 0)
6093
__version__ = repr(version_info)
6194

6295
__all__ = (
63-
"BadRequestError", "Bot", "ChatCommandHandler", "Client", "Cog",
64-
"CogAlreadyExists", "CogError", "CogNotFound", "CommandAlreadyRegistered",
65-
"CommandCooldownError", "CommandDescriptionTooLong", "CommandError",
66-
"CommandIsNotCoroutine", "CommandReturnIsEmpty", "DisallowedIntentsError",
67-
"DispatchError", "EmbedFieldError", "EmbedOverflow", "ForbiddenError",
68-
"GatewayConfig", "GatewayError", "HTTPError", "HeartbeatError",
69-
"ImageEncodingError", "Intents", "InvalidArgumentAnnotation",
70-
"InvalidCommandGuild", "InvalidCommandName", "InvalidEventName",
71-
"InvalidPayload", "InvalidTokenError", "InvalidUrlError",
72-
"MethodNotAllowedError", "NoCogManagerReturnFound", "NoExportMethod",
73-
"NoValidSetupMethod", "NotFoundError", "NotModifiedError", "PincerError",
74-
"RateLimitError", "ServerError", "TaskAlreadyRunning", "TaskCancelError",
75-
"TaskError", "TaskInvalidDelay", "TaskIsNotCoroutine", "TooManyArguments",
76-
"TooManySetupArguments", "UnauthorizedError", "UnavailableGuildError",
77-
"UnhandledException", "__author__", "__email__", "__package__",
78-
"__title__", "__version__", "command", "event_middleware"
96+
"BadRequestError",
97+
"Bot",
98+
"ChatCommandHandler",
99+
"Client",
100+
"Cog",
101+
"CogAlreadyExists",
102+
"CogError",
103+
"CogNotFound",
104+
"CommandAlreadyRegistered",
105+
"CommandCooldownError",
106+
"CommandDescriptionTooLong",
107+
"CommandError",
108+
"CommandIsNotCoroutine",
109+
"CommandReturnIsEmpty",
110+
"DisallowedIntentsError",
111+
"DispatchError",
112+
"EmbedFieldError",
113+
"EmbedOverflow",
114+
"ForbiddenError",
115+
"GatewayConfig",
116+
"GatewayError",
117+
"HTTPError",
118+
"HeartbeatError",
119+
"ImageEncodingError",
120+
"Intents",
121+
"InvalidArgumentAnnotation",
122+
"InvalidCommandGuild",
123+
"InvalidCommandName",
124+
"InvalidEventName",
125+
"InvalidPayload",
126+
"InvalidTokenError",
127+
"InvalidUrlError",
128+
"MethodNotAllowedError",
129+
"NoCogManagerReturnFound",
130+
"NoExportMethod",
131+
"NoValidSetupMethod",
132+
"NotFoundError",
133+
"NotModifiedError",
134+
"PincerError",
135+
"RateLimitError",
136+
"ServerError",
137+
"TaskAlreadyRunning",
138+
"TaskCancelError",
139+
"TaskError",
140+
"TaskInvalidDelay",
141+
"TaskIsNotCoroutine",
142+
"TooManyArguments",
143+
"TooManySetupArguments",
144+
"UnauthorizedError",
145+
"UnavailableGuildError",
146+
"UnhandledException",
147+
"__author__",
148+
"__email__",
149+
"__package__",
150+
"__title__",
151+
"__version__",
152+
"command",
153+
"event_middleware",
79154
)

pincer/_config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class GatewayConfig:
99
"""This file is to make maintaining the library and its gateway
1010
configuration easier. Leave compression blank for no compression.
1111
"""
12+
1213
MAX_RETRIES: int = 5
1314
version: int = 9
1415
encoding: str = "json"
@@ -23,9 +24,7 @@ def make_uri(cls, uri) -> str:
2324
The GatewayConfig's uri.
2425
"""
2526
return (
26-
f"{uri}"
27-
f"?v={cls.version}"
28-
f"&encoding={cls.encoding}"
27+
f"{uri}" f"?v={cls.version}" f"&encoding={cls.encoding}"
2928
) + f"&compress={cls.compression}" * cls.compressed()
3029

3130
@classmethod

pincer/client.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ def chat_commands(self) -> List[str]:
258258
Get a list of chat command calls which have been registered in
259259
the :class:`~pincer.commands.ChatCommandHandler`\\.
260260
"""
261-
return [cmd.metadata.name for cmd in ChatCommandHandler.register.values()]
261+
return [
262+
cmd.metadata.name for cmd in ChatCommandHandler.register.values()
263+
]
262264

263265
@property
264266
def guild_ids(self) -> List[Snowflake]:
@@ -346,7 +348,9 @@ async def on_ready(self):
346348
return event
347349

348350
@staticmethod
349-
def get_event_coro(name: str) -> List[Optional[InteractableStructure[None]]]:
351+
def get_event_coro(
352+
name: str,
353+
) -> List[Optional[InteractableStructure[None]]]:
350354
"""get the coroutine for an event
351355
352356
Parameters
@@ -372,10 +376,7 @@ def get_event_coro(name: str) -> List[Optional[InteractableStructure[None]]]:
372376

373377
@staticmethod
374378
def execute_event(
375-
events: List[InteractableStructure],
376-
gateway: Gateway,
377-
*args,
378-
**kwargs
379+
events: List[InteractableStructure], gateway: Gateway, *args, **kwargs
379380
):
380381
"""Invokes an event.
381382
@@ -1185,7 +1186,9 @@ async def delete_stage(self, _id: int, reason: Optional[str] = None):
11851186
f"stage-instances/{_id}", headers={"reason": reason}
11861187
)
11871188

1188-
async def crosspost_message(self, channel_id: int, message_id: int) -> UserMessage:
1189+
async def crosspost_message(
1190+
self, channel_id: int, message_id: int
1191+
) -> UserMessage:
11891192
"""|coro|
11901193
Crosspost a message in a News Channel to following channels.
11911194
@@ -1207,6 +1210,9 @@ async def crosspost_message(self, channel_id: int, message_id: int) -> UserMessa
12071210
The crossposted message
12081211
"""
12091212

1210-
return await self._http.post(f"channels/{channel_id}/{message_id}/crosspost")
1213+
return await self._http.post(
1214+
f"channels/{channel_id}/{message_id}/crosspost"
1215+
)
1216+
12111217

12121218
Bot = Client

pincer/cog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ def cogs(self) -> List[Cog]:
128128
The list of cogs
129129
"""
130130
return [
131-
manager for manager in ChatCommandHandler.managers
131+
manager
132+
for manager in ChatCommandHandler.managers
132133
if isinstance(manager, Cog)
133134
]
134135

pincer/commands/__init__.py

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,45 @@
1414
Modifier,
1515
)
1616
from .components import (
17-
ActionRow, Button, ButtonStyle, ComponentHandler, SelectMenu, SelectOption,
18-
component, button, select_menu, LinkButton
17+
ActionRow,
18+
Button,
19+
ButtonStyle,
20+
ComponentHandler,
21+
SelectMenu,
22+
SelectOption,
23+
component,
24+
button,
25+
select_menu,
26+
LinkButton,
1927
)
2028
from .groups import Group, Subgroup
2129
from .interactable import Interactable, INTERACTION_REGISTERS
2230

2331
__all__ = (
24-
"ActionRow", "Button", "ButtonStyle", "ChannelTypes",
25-
"ChatCommandHandler", "Choice", "Choices", "CommandArg",
26-
"ComponentHandler", "Description", "Group", "INTERACTION_REGISTERS",
27-
"Interactable", "LinkButton", "MaxValue", "MinValue", "Modifier",
28-
"SelectMenu", "SelectOption", "Subgroup", "button", "command", "component",
29-
"message_command", "select_menu", "user_command"
32+
"ActionRow",
33+
"Button",
34+
"ButtonStyle",
35+
"ChannelTypes",
36+
"ChatCommandHandler",
37+
"Choice",
38+
"Choices",
39+
"CommandArg",
40+
"ComponentHandler",
41+
"Description",
42+
"Group",
43+
"INTERACTION_REGISTERS",
44+
"Interactable",
45+
"LinkButton",
46+
"MaxValue",
47+
"MinValue",
48+
"Modifier",
49+
"SelectMenu",
50+
"SelectOption",
51+
"Subgroup",
52+
"button",
53+
"command",
54+
"component",
55+
"message_command",
56+
"select_menu",
57+
"user_command",
3058
)

0 commit comments

Comments
 (0)