From aafd322bd02e995460d6aaa75fb5f084ce82d9e2 Mon Sep 17 00:00:00 2001 From: BobDotCom <71356958+BobDotCom@users.noreply.github.com> Date: Fri, 10 Feb 2023 12:23:01 -0600 Subject: [PATCH] style(pre-commit): disable black --preview flag --- .pre-commit-config.yaml | 2 +- discord/appinfo.py | 4 +--- discord/audit_logs.py | 15 ++++++--------- discord/client.py | 6 +++--- discord/cog.py | 6 +++--- discord/commands/core.py | 24 ++++++++++++------------ discord/guild.py | 5 +++-- discord/invite.py | 4 +--- discord/member.py | 12 ++++++------ discord/partial_emoji.py | 4 +--- discord/ui/view.py | 4 +--- discord/welcome_screen.py | 4 +--- 12 files changed, 39 insertions(+), 51 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 140cdfb53c..50d52ea416 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: rev: 23.1.0 hooks: - id: black - args: [--safe, --quiet, --preview] + args: [--safe, --quiet] - repo: https://github.com/Pierre-Sassoulas/black-disable-checker rev: v1.1.3 hooks: diff --git a/discord/appinfo.py b/discord/appinfo.py index 5f0a37974d..9554c96b5d 100644 --- a/discord/appinfo.py +++ b/discord/appinfo.py @@ -249,9 +249,7 @@ def __init__(self, *, state: ConnectionState, data: PartialAppInfoPayload): self.privacy_policy_url: str | None = data.get("privacy_policy_url") def __repr__(self) -> str: - return ( - f"<{self.__class__.__name__} id={self.id} name={self.name!r} description={self.description!r}>" - ) + return f"<{self.__class__.__name__} id={self.id} name={self.name!r} description={self.description!r}>" @property def icon(self) -> Asset | None: diff --git a/discord/audit_logs.py b/discord/audit_logs.py index f8e927fbd0..c427534ea7 100644 --- a/discord/audit_logs.py +++ b/discord/audit_logs.py @@ -451,9 +451,8 @@ def _from_data(self, data: AuditLogEntryPayload) -> None: channel_id = int(self.extra["channel_id"]) elems = { "count": int(self.extra["count"]), - "channel": self.guild.get_channel(channel_id) or Object( - id=channel_id - ), + "channel": self.guild.get_channel(channel_id) + or Object(id=channel_id), } self.extra: _AuditLogProxyMemberMoveOrMessageDelete = type( "_AuditLogProxy", (), elems @@ -470,9 +469,8 @@ def _from_data(self, data: AuditLogEntryPayload) -> None: # the pin actions have a dict with some information channel_id = int(self.extra["channel_id"]) elems = { - "channel": self.guild.get_channel(channel_id) or Object( - id=channel_id - ), + "channel": self.guild.get_channel(channel_id) + or Object(id=channel_id), "message_id": int(self.extra["message_id"]), } self.extra: _AuditLogProxyPinAction = type( @@ -493,9 +491,8 @@ def _from_data(self, data: AuditLogEntryPayload) -> None: elif self.action.name.startswith("stage_instance"): channel_id = int(self.extra["channel_id"]) elems = { - "channel": self.guild.get_channel(channel_id) or Object( - id=channel_id - ) + "channel": self.guild.get_channel(channel_id) + or Object(id=channel_id) } self.extra: _AuditLogProxyStageInstanceAction = type( "_AuditLogProxy", (), elems diff --git a/discord/client.py b/discord/client.py index 1e635d9b8c..21abf9e7c0 100644 --- a/discord/client.py +++ b/discord/client.py @@ -216,9 +216,9 @@ def __init__( self.loop: asyncio.AbstractEventLoop = ( asyncio.get_event_loop() if loop is None else loop ) - self._listeners: dict[str, list[tuple[asyncio.Future, Callable[..., bool]]]] = ( - {} - ) + self._listeners: dict[ + str, list[tuple[asyncio.Future, Callable[..., bool]]] + ] = {} self.shard_id: int | None = options.get("shard_id") self.shard_count: int | None = options.get("shard_count") diff --git a/discord/cog.py b/discord/cog.py index 289d04cf10..9e3d8733a4 100644 --- a/discord/cog.py +++ b/discord/cog.py @@ -201,9 +201,9 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta: commands[f"app_{elem}"] = value.slash_variant commands[elem] = value for cmd in getattr(value, "subcommands", []): - commands[f"ext_{cmd.ext_variant.qualified_name}"] = ( - cmd.ext_variant - ) + commands[ + f"ext_{cmd.ext_variant.qualified_name}" + ] = cmd.ext_variant if inspect.iscoroutinefunction(value): try: diff --git a/discord/commands/core.py b/discord/commands/core.py index f2bd942736..792adda6d7 100644 --- a/discord/commands/core.py +++ b/discord/commands/core.py @@ -857,9 +857,9 @@ def to_dict(self) -> dict: as_dict["nsfw"] = self.nsfw if self.default_member_permissions is not None: - as_dict["default_member_permissions"] = ( - self.default_member_permissions.value - ) + as_dict[ + "default_member_permissions" + ] = self.default_member_permissions.value return as_dict @@ -1126,9 +1126,9 @@ def __init__( validate_chat_input_name(self.name) validate_chat_input_description(self.description) self.input_type = SlashCommandOptionType.sub_command_group - self.subcommands: list[SlashCommand | SlashCommandGroup] = ( - self.__initial_commands__ - ) + self.subcommands: list[ + SlashCommand | SlashCommandGroup + ] = self.__initial_commands__ self.guild_ids = guild_ids self.parent = parent self.attached_to_group: bool = False @@ -1178,9 +1178,9 @@ def to_dict(self) -> dict: as_dict["nsfw"] = self.nsfw if self.default_member_permissions is not None: - as_dict["default_member_permissions"] = ( - self.default_member_permissions.value - ) + as_dict[ + "default_member_permissions" + ] = self.default_member_permissions.value return as_dict @@ -1502,9 +1502,9 @@ def to_dict(self) -> dict[str, str | int]: as_dict["nsfw"] = self.nsfw if self.default_member_permissions is not None: - as_dict["default_member_permissions"] = ( - self.default_member_permissions.value - ) + as_dict[ + "default_member_permissions" + ] = self.default_member_permissions.value if self.name_localizations is not None: as_dict["name_localizations"] = self.name_localizations diff --git a/discord/guild.py b/discord/guild.py index 0e516ae1f5..06fbc2ffd1 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -2489,8 +2489,9 @@ def convert(d): factory, _ = _integration_factory(d["type"]) if factory is None: raise InvalidData( - "Unknown integration type {type!r} for integration ID {id}" - .format_map(d) + "Unknown integration type {type!r} for integration ID {id}".format_map( + d + ) ) return factory(guild=self, data=d) diff --git a/discord/invite.py b/discord/invite.py index 76eff8ec6a..2560bf9996 100644 --- a/discord/invite.py +++ b/discord/invite.py @@ -504,9 +504,7 @@ def id(self) -> str: @property def url(self) -> str: """A property that retrieves the invite URL.""" - return ( - f"{self.BASE}/{self.code}{f'?event={self.scheduled_event.id}' if self.scheduled_event else ''}" - ) + return f"{self.BASE}/{self.code}{f'?event={self.scheduled_event.id}' if self.scheduled_event else ''}" async def delete(self, *, reason: str | None = None): """|coro| diff --git a/discord/member.py b/discord/member.py index bb9afb0c4e..0c798a725d 100644 --- a/discord/member.py +++ b/discord/member.py @@ -805,9 +805,9 @@ async def edit( await http.edit_my_voice_state(guild_id, voice_state_payload) else: if not suppress: - voice_state_payload["request_to_speak_timestamp"] = ( - datetime.datetime.utcnow().isoformat() - ) + voice_state_payload[ + "request_to_speak_timestamp" + ] = datetime.datetime.utcnow().isoformat() await http.edit_voice_state(guild_id, self.id, voice_state_payload) if voice_channel is not MISSING: @@ -818,9 +818,9 @@ async def edit( if communication_disabled_until is not MISSING: if communication_disabled_until is not None: - payload["communication_disabled_until"] = ( - communication_disabled_until.isoformat() - ) + payload[ + "communication_disabled_until" + ] = communication_disabled_until.isoformat() else: payload["communication_disabled_until"] = communication_disabled_until diff --git a/discord/partial_emoji.py b/discord/partial_emoji.py index f575a21c04..dd2d6fa04d 100644 --- a/discord/partial_emoji.py +++ b/discord/partial_emoji.py @@ -192,9 +192,7 @@ def __str__(self) -> str: return f"<{animated_tag}:{name}:{self.id}>" def __repr__(self): - return ( - f"<{self.__class__.__name__} animated={self.animated} name={self.name!r} id={self.id}>" - ) + return f"<{self.__class__.__name__} animated={self.animated} name={self.name!r} id={self.id}>" def __eq__(self, other: Any) -> bool: if self.is_unicode_emoji(): diff --git a/discord/ui/view.py b/discord/ui/view.py index 732ac1541d..8172e726f8 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -189,9 +189,7 @@ def __init__( self._message: Message | InteractionMessage | None = None def __repr__(self) -> str: - return ( - f"<{self.__class__.__name__} timeout={self.timeout} children={len(self.children)}>" - ) + return f"<{self.__class__.__name__} timeout={self.timeout} children={len(self.children)}>" async def __timeout_task_impl(self) -> None: while True: diff --git a/discord/welcome_screen.py b/discord/welcome_screen.py index aafc59ef6c..ae0a98da08 100644 --- a/discord/welcome_screen.py +++ b/discord/welcome_screen.py @@ -73,9 +73,7 @@ def __init__( self.emoji = emoji def __repr__(self): - return ( - f"WelcomeScreenChannel(channel={self.channel} description={self.description})" - ) + return f"WelcomeScreenChannel(channel={self.channel} description={self.description})" def to_dict(self) -> WelcomeScreenChannelPayload: dict_: WelcomeScreenChannelPayload = {