Skip to content

Commit

Permalink
style(pre-commit): disable black --preview flag
Browse files Browse the repository at this point in the history
  • Loading branch information
BobDotCom committed Feb 10, 2023
1 parent 4c4ea4b commit aafd322
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions discord/appinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 6 additions & 9 deletions discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
6 changes: 3 additions & 3 deletions discord/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 12 additions & 12 deletions discord/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 1 addition & 3 deletions discord/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
12 changes: 6 additions & 6 deletions discord/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down
4 changes: 1 addition & 3 deletions discord/partial_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 1 addition & 3 deletions discord/ui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions discord/welcome_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit aafd322

Please sign in to comment.