Skip to content

Commit 4fc423d

Browse files
chore(pre-commit): pre-commit autoupdate (#1909)
* chore(pre-commit): pre-commit autoupdate updates: - [github.com/PyCQA/autoflake: v2.0.0 → v2.0.1](PyCQA/autoflake@v2.0.0...v2.0.1) - [github.com/psf/black: 22.12.0 → 23.1.0](psf/black@22.12.0...23.1.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove stale comment The preview feature was moved to stable in v23, and the bug previously preventing us from using the new style was fixed in psf/black#3430 Signed-off-by: BobDotCom <[email protected]> * try preview flag for black Signed-off-by: BobDotCom <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * style(pre-commit): disable black --preview flag --------- Signed-off-by: BobDotCom <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: BobDotCom <[email protected]>
1 parent 08af163 commit 4fc423d

28 files changed

+169
-92
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
1010
- repo: https://github.com/PyCQA/autoflake
11-
rev: v2.0.0
11+
rev: v2.0.1
1212
hooks:
1313
- id: autoflake
1414
# args:
@@ -27,10 +27,9 @@ repos:
2727
hooks:
2828
- id: isort
2929
- repo: https://github.com/psf/black
30-
rev: 22.12.0
30+
rev: 23.1.0
3131
hooks:
3232
- id: black
33-
# See https://github.com/psf/black/issues/2188#issuecomment-1289317647 for why we can't use the --preview flag.
3433
args: [--safe, --quiet]
3534
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker
3635
rev: v1.1.3

discord/_version.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
# setuptools_scm is not installed
4848
__version__ = "0.0.0"
4949
warnings.warn(
50-
"Package is not installed, and setuptools_scm is not installed. "
51-
f"As a fallback, {__name__}.__version__ will be set to {__version__}",
50+
(
51+
"Package is not installed, and setuptools_scm is not installed. "
52+
f"As a fallback, {__name__}.__version__ will be set to {__version__}"
53+
),
5254
RuntimeWarning,
5355
stacklevel=2,
5456
)

discord/abc.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,11 @@ async def _edit(
478478
"allow": allow.value,
479479
"deny": deny.value,
480480
"id": target.id,
481-
"type": _Overwrites.ROLE
482-
if isinstance(target, Role)
483-
else _Overwrites.MEMBER,
481+
"type": (
482+
_Overwrites.ROLE
483+
if isinstance(target, Role)
484+
else _Overwrites.MEMBER
485+
),
484486
}
485487

486488
perms.append(payload)

discord/application_role_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(
8989

9090
def __repr__(self):
9191
return (
92-
f"<ApplicationRoleConnectionMetadata "
92+
"<ApplicationRoleConnectionMetadata "
9393
f"type={self.type!r} "
9494
f"key={self.key!r} "
9595
f"name={self.name!r} "

discord/channel.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,15 @@ def __init__(
142142
self.emoji = PartialEmoji.from_str(emoji)
143143
else:
144144
raise TypeError(
145-
f"emoji must be a Emoji, PartialEmoji, or str and not {emoji.__class__!r}"
145+
"emoji must be a Emoji, PartialEmoji, or str and not"
146+
f" {emoji.__class__!r}"
146147
)
147148

148149
def __repr__(self) -> str:
149-
return f"<ForumTag id={self.id} name={self.name!r} emoji={self.emoji!r} moderated={self.moderated}>"
150+
return (
151+
"<ForumTag"
152+
f" id={self.id} name={self.name!r} emoji={self.emoji!r} moderated={self.moderated}>"
153+
)
150154

151155
def __str__(self) -> str:
152156
return self.name

discord/cog.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
232232
# r.e type ignore, type-checker complains about overriding a ClassVar
233233
new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) if not hasattr(c, "add_to") else c for c in new_cls.__cog_commands__) # type: ignore
234234

235-
name_filter = (
236-
lambda c: "app"
235+
name_filter = lambda c: (
236+
"app"
237237
if isinstance(c, ApplicationCommand)
238238
else ("bridge" if not hasattr(c, "add_to") else "ext")
239239
)
@@ -1019,8 +1019,10 @@ def load_extensions(
10191019
loaded = self.load_extension(
10201020
ext_path, package=package, recursive=recursive, store=store
10211021
)
1022-
loaded_extensions.update(loaded) if store else loaded_extensions.extend(
1023-
loaded
1022+
(
1023+
loaded_extensions.update(loaded)
1024+
if store
1025+
else loaded_extensions.extend(loaded)
10241026
)
10251027

10261028
return loaded_extensions

discord/commands/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,8 +910,10 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
910910
):
911911
arg = ctx.guild.get_channel_or_thread(int(arg))
912912
_data["_invoke_flag"] = True
913-
arg._update(_data) if isinstance(arg, Thread) else arg._update(
914-
ctx.guild, _data
913+
(
914+
arg._update(_data)
915+
if isinstance(arg, Thread)
916+
else arg._update(ctx.guild, _data)
915917
)
916918
else:
917919
obj_type = None

discord/enums.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ def category(self) -> AuditLogActionCategory | None:
489489
AuditLogAction.thread_create: AuditLogActionCategory.create,
490490
AuditLogAction.thread_update: AuditLogActionCategory.update,
491491
AuditLogAction.thread_delete: AuditLogActionCategory.delete,
492-
AuditLogAction.application_command_permission_update: AuditLogActionCategory.update,
492+
AuditLogAction.application_command_permission_update: (
493+
AuditLogActionCategory.update
494+
),
493495
AuditLogAction.auto_moderation_rule_create: AuditLogActionCategory.create,
494496
AuditLogAction.auto_moderation_rule_update: AuditLogActionCategory.update,
495497
AuditLogAction.auto_moderation_rule_delete: AuditLogActionCategory.delete,

discord/ext/commands/core.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,9 +2010,11 @@ def predicate(ctx):
20102010
# ctx.guild is None doesn't narrow ctx.author to Member
20112011
getter = functools.partial(discord.utils.get, ctx.author.roles) # type: ignore
20122012
if any(
2013-
getter(id=item) is not None
2014-
if isinstance(item, int)
2015-
else getter(name=item) is not None
2013+
(
2014+
getter(id=item) is not None
2015+
if isinstance(item, int)
2016+
else getter(name=item) is not None
2017+
)
20162018
for item in items
20172019
):
20182020
return True
@@ -2072,9 +2074,11 @@ def predicate(ctx):
20722074
me = ctx.me
20732075
getter = functools.partial(discord.utils.get, me.roles)
20742076
if any(
2075-
getter(id=item) is not None
2076-
if isinstance(item, int)
2077-
else getter(name=item) is not None
2077+
(
2078+
getter(id=item) is not None
2079+
if isinstance(item, int)
2080+
else getter(name=item) is not None
2081+
)
20782082
for item in items
20792083
):
20802084
return True

discord/ext/pages/pagination.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -766,21 +766,27 @@ def add_button(self, button: PaginatorButton):
766766
self.buttons[button.button_type] = {
767767
"object": discord.ui.Button(
768768
style=button.style,
769-
label=button.label
770-
if button.label or button.emoji
771-
else button.button_type.capitalize()
772-
if button.button_type != "page_indicator"
773-
else f"{self.current_page + 1}/{self.page_count + 1}",
769+
label=(
770+
button.label
771+
if button.label or button.emoji
772+
else (
773+
button.button_type.capitalize()
774+
if button.button_type != "page_indicator"
775+
else f"{self.current_page + 1}/{self.page_count + 1}"
776+
)
777+
),
774778
disabled=button.disabled,
775779
custom_id=button.custom_id,
776780
emoji=button.emoji,
777781
row=button.row,
778782
),
779783
"label": button.label,
780784
"loop_label": button.loop_label,
781-
"hidden": button.disabled
782-
if button.button_type != "page_indicator"
783-
else not self.show_indicator,
785+
"hidden": (
786+
button.disabled
787+
if button.button_type != "page_indicator"
788+
else not self.show_indicator
789+
),
784790
}
785791
self.buttons[button.button_type]["object"].callback = button.callback
786792
button.paginator = self

discord/gateway.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,10 @@ def run(self):
140140
while not self._stop_ev.wait(self.interval):
141141
if self._last_recv + self.heartbeat_timeout < time.perf_counter():
142142
_log.warning(
143-
"Shard ID %s has stopped responding to the gateway. Closing and"
144-
" restarting.",
143+
(
144+
"Shard ID %s has stopped responding to the gateway. Closing and"
145+
" restarting."
146+
),
145147
self.shard_id,
146148
)
147149
coro = self.ws.close(4000)

discord/guild.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,9 +1140,11 @@ def _create_channel(
11401140
"allow": allow.value,
11411141
"deny": deny.value,
11421142
"id": target.id,
1143-
"type": abc._Overwrites.ROLE
1144-
if isinstance(target, Role)
1145-
else abc._Overwrites.MEMBER,
1143+
"type": (
1144+
abc._Overwrites.ROLE
1145+
if isinstance(target, Role)
1146+
else abc._Overwrites.MEMBER
1147+
),
11461148
}
11471149

11481150
perms.append(payload)

discord/http.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,10 @@ async def request(
302302
response, use_clock=self.use_clock
303303
)
304304
_log.debug(
305-
"A rate limit bucket has been exhausted (bucket: %s,"
306-
" retry: %s).",
305+
(
306+
"A rate limit bucket has been exhausted (bucket:"
307+
" %s, retry: %s)."
308+
),
307309
bucket,
308310
delta,
309311
)
@@ -334,8 +336,10 @@ async def request(
334336
is_global = data.get("global", False)
335337
if is_global:
336338
_log.warning(
337-
"Global rate limit has been hit. Retrying in %.2f"
338-
" seconds.",
339+
(
340+
"Global rate limit has been hit. Retrying in"
341+
" %.2f seconds."
342+
),
339343
retry_after,
340344
)
341345
self._global_over.clear()

discord/iterators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@ def create_member(self, data):
689689

690690
class BanIterator(_AsyncIterator["BanEntry"]):
691691
def __init__(self, guild, limit=None, before=None, after=None):
692-
693692
self.guild = guild
694693
self.limit = limit
695694
self.after = after

discord/opus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def set_bandwidth(self, req: BAND_CTL) -> None:
398398
if req not in band_ctl:
399399
raise KeyError(
400400
f"{req!r} is not a valid bandwidth setting. Try one of:"
401-
f' {",".join(band_ctl)}'
401+
f" {','.join(band_ctl)}"
402402
)
403403

404404
k = band_ctl[req]
@@ -408,7 +408,7 @@ def set_signal_type(self, req: SIGNAL_CTL) -> None:
408408
if req not in signal_ctl:
409409
raise KeyError(
410410
f"{req!r} is not a valid bandwidth setting. Try one of:"
411-
f' {",".join(signal_ctl)}'
411+
f" {','.join(signal_ctl)}"
412412
)
413413

414414
k = signal_ctl[req]

discord/partial_emoji.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,8 @@ def _to_partial(self) -> PartialEmoji:
162162

163163
def _to_forum_tag_payload(
164164
self,
165-
) -> (
166-
TypedDict("TagPayload", {"emoji_id": int, "emoji_name": None})
167-
| TypedDict("TagPayload", {"emoji_id": None, "emoji_name": str})
165+
) -> TypedDict("TagPayload", {"emoji_id": int, "emoji_name": None}) | TypedDict(
166+
"TagPayload", {"emoji_id": None, "emoji_name": str}
168167
):
169168
if self.id is None:
170169
return {"emoji_id": None, "emoji_name": self.name}

0 commit comments

Comments
 (0)