Skip to content

Commit be67285

Browse files
style(pre-commit): auto fixes from pre-commit.com hooks
1 parent 8c5c945 commit be67285

File tree

21 files changed

+61
-62
lines changed

21 files changed

+61
-62
lines changed

discord/abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ async def send(
15261526
if reference is not None:
15271527
try:
15281528
_reference = reference.to_message_reference_dict()
1529-
from .message import MessageReference # noqa: PLC0415
1529+
from .message import MessageReference
15301530

15311531
if not isinstance(reference, MessageReference):
15321532
utils.warn_deprecated(

discord/appinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class AppInfo:
182182
)
183183

184184
def __init__(self, state: ConnectionState, data: AppInfoPayload):
185-
from .team import Team # noqa: PLC0415
185+
from .team import Team
186186

187187
self._state: ConnectionState = state
188188
self.id: int = int(data["id"])

discord/audit_logs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def __init__(
335335
before = transformer(entry, before)
336336

337337
if attr == "location" and hasattr(self.before, "location_type"):
338-
from .scheduled_events import ScheduledEventLocation # noqa: PLC0415
338+
from .scheduled_events import ScheduledEventLocation
339339

340340
if self.before.location_type is enums.ScheduledEventLocationType.external:
341341
before = ScheduledEventLocation(state=state, value=before)
@@ -353,7 +353,7 @@ def __init__(
353353
after = transformer(entry, after)
354354

355355
if attr == "location" and hasattr(self.after, "location_type"):
356-
from .scheduled_events import ScheduledEventLocation # noqa: PLC0415
356+
from .scheduled_events import ScheduledEventLocation
357357

358358
if self.after.location_type is enums.ScheduledEventLocationType.external:
359359
after = ScheduledEventLocation(state=state, value=after)

discord/channel.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ async def webhooks(self) -> list[Webhook]:
457457
You don't have permissions to get the webhooks.
458458
"""
459459

460-
from .webhook import Webhook # noqa: PLC0415
460+
from .webhook import Webhook
461461

462462
data = await self._state.http.channel_webhooks(self.id)
463463
return [Webhook.from_state(d, state=self._state) for d in data]
@@ -495,7 +495,7 @@ async def create_webhook(self, *, name: str, avatar: bytes | None = None, reason
495495
You do not have permissions to create a webhook.
496496
"""
497497

498-
from .webhook import Webhook # noqa: PLC0415
498+
from .webhook import Webhook
499499

500500
if avatar is not None:
501501
avatar = utils._bytes_to_base64_data(avatar) # type: ignore
@@ -544,7 +544,7 @@ async def follow(self, *, destination: TextChannel, reason: str | None = None) -
544544
if not isinstance(destination, TextChannel):
545545
raise InvalidArgument(f"Expected TextChannel received {destination.__class__.__name__}")
546546

547-
from .webhook import Webhook # noqa: PLC0415
547+
from .webhook import Webhook
548548

549549
data = await self._state.http.follow_webhook(self.id, webhook_channel_id=destination.id, reason=reason)
550550
return Webhook._as_follower(data, channel=destination, user=self._state.user)
@@ -568,7 +568,7 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
568568
The partial message.
569569
"""
570570

571-
from .message import PartialMessage # noqa: PLC0415
571+
from .message import PartialMessage
572572

573573
return PartialMessage(channel=self, id=message_id)
574574

@@ -1740,7 +1740,7 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
17401740
The partial message.
17411741
"""
17421742

1743-
from .message import PartialMessage # noqa: PLC0415
1743+
from .message import PartialMessage
17441744

17451745
return PartialMessage(channel=self, id=message_id)
17461746

@@ -1895,7 +1895,7 @@ async def webhooks(self) -> list[Webhook]:
18951895
You don't have permissions to get the webhooks.
18961896
"""
18971897

1898-
from .webhook import Webhook # noqa: PLC0415
1898+
from .webhook import Webhook
18991899

19001900
data = await self._state.http.channel_webhooks(self.id)
19011901
return [Webhook.from_state(d, state=self._state) for d in data]
@@ -1933,7 +1933,7 @@ async def create_webhook(self, *, name: str, avatar: bytes | None = None, reason
19331933
You do not have permissions to create a webhook.
19341934
"""
19351935

1936-
from .webhook import Webhook # noqa: PLC0415
1936+
from .webhook import Webhook
19371937

19381938
if avatar is not None:
19391939
avatar = utils._bytes_to_base64_data(avatar) # type: ignore
@@ -2267,7 +2267,7 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
22672267
The partial message.
22682268
"""
22692269

2270-
from .message import PartialMessage # noqa: PLC0415
2270+
from .message import PartialMessage
22712271

22722272
return PartialMessage(channel=self, id=message_id)
22732273

@@ -2422,7 +2422,7 @@ async def webhooks(self) -> list[Webhook]:
24222422
You don't have permissions to get the webhooks.
24232423
"""
24242424

2425-
from .webhook import Webhook # noqa: PLC0415
2425+
from .webhook import Webhook
24262426

24272427
data = await self._state.http.channel_webhooks(self.id)
24282428
return [Webhook.from_state(d, state=self._state) for d in data]
@@ -2460,7 +2460,7 @@ async def create_webhook(self, *, name: str, avatar: bytes | None = None, reason
24602460
You do not have permissions to create a webhook.
24612461
"""
24622462

2463-
from .webhook import Webhook # noqa: PLC0415
2463+
from .webhook import Webhook
24642464

24652465
if avatar is not None:
24662466
avatar = utils._bytes_to_base64_data(avatar) # type: ignore
@@ -3051,7 +3051,7 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
30513051
The partial message.
30523052
"""
30533053

3054-
from .message import PartialMessage # noqa: PLC0415
3054+
from .message import PartialMessage
30553055

30563056
return PartialMessage(channel=self, id=message_id)
30573057

@@ -3274,7 +3274,7 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
32743274
The partial message.
32753275
"""
32763276

3277-
from .message import PartialMessage # noqa: PLC0415
3277+
from .message import PartialMessage
32783278

32793279
return PartialMessage(channel=self, id=message_id)
32803280

discord/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ def get_stage_instance(self, id: int, /) -> StageInstance | None:
976976
Optional[:class:`.StageInstance`]
977977
The stage instance or ``None`` if not found.
978978
"""
979-
from .channel import StageChannel # noqa: PLC0415
979+
from .channel import StageChannel
980980

981981
channel = self._connection.get_channel(id)
982982

discord/commands/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110

111111

112112
def wrap_callback(coro):
113-
from ..ext.commands.errors import CommandError # noqa: PLC0415
113+
from ..ext.commands.errors import CommandError
114114

115115
@functools.wraps(coro)
116116
async def wrapped(*args, **kwargs):
@@ -130,7 +130,7 @@ async def wrapped(*args, **kwargs):
130130

131131

132132
def hooked_wrapped_callback(command, ctx, coro):
133-
from ..ext.commands.errors import CommandError # noqa: PLC0415
133+
from ..ext.commands.errors import CommandError
134134

135135
@functools.wraps(coro)
136136
async def wrapped(arg):
@@ -187,7 +187,7 @@ class ApplicationCommand(_BaseCommand, Generic[CogT, P, T]):
187187
cog = None
188188

189189
def __init__(self, func: Callable, **kwargs) -> None:
190-
from ..ext.commands.cooldowns import BucketType, CooldownMapping, MaxConcurrency # noqa: PLC0415
190+
from ..ext.commands.cooldowns import BucketType, CooldownMapping, MaxConcurrency
191191

192192
cooldown = getattr(func, "__commands_cooldown__", kwargs.get("cooldown"))
193193

@@ -329,7 +329,7 @@ def _prepare_cooldowns(self, ctx: ApplicationContext):
329329
retry_after = bucket.update_rate_limit(current)
330330

331331
if retry_after:
332-
from ..ext.commands.errors import CommandOnCooldown # noqa: PLC0415
332+
from ..ext.commands.errors import CommandOnCooldown
333333

334334
raise CommandOnCooldown(bucket, retry_after, self._buckets.type) # type: ignore
335335

@@ -981,7 +981,7 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
981981
arg = Object(id=int(arg))
982982

983983
elif op.input_type == SlashCommandOptionType.string and (converter := op.converter) is not None:
984-
from discord.ext.commands import Converter # noqa: PLC0415
984+
from discord.ext.commands import Converter
985985

986986
if isinstance(converter, Converter):
987987
if isinstance(converter, type):
@@ -1206,7 +1206,7 @@ def __init__(
12061206
self.description_localizations: dict[str, str] = kwargs.get("description_localizations", MISSING)
12071207

12081208
# similar to ApplicationCommand
1209-
from ..ext.commands.cooldowns import BucketType, CooldownMapping, MaxConcurrency # noqa: PLC0415
1209+
from ..ext.commands.cooldowns import BucketType, CooldownMapping, MaxConcurrency
12101210

12111211
# no need to getattr, since slash cmds groups cant be created using a decorator
12121212

discord/commands/options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def __init__(self, input_type: InputType = str, /, description: str | None = Non
224224
if isinstance(input_type, SlashCommandOptionType):
225225
self.input_type = input_type
226226
else:
227-
from ..ext.commands import Converter # noqa: PLC0415
227+
from ..ext.commands import Converter
228228

229229
if isinstance(input_type, tuple) and any(issubclass(op, ApplicationContext) for op in input_type):
230230
input_type = next(op for op in input_type if issubclass(op, ApplicationContext))
@@ -237,7 +237,7 @@ def __init__(self, input_type: InputType = str, /, description: str | None = Non
237237
try:
238238
self.input_type = SlashCommandOptionType.from_datatype(input_type)
239239
except TypeError as exc:
240-
from ..ext.commands.converter import CONVERTER_MAPPING # noqa: PLC0415
240+
from ..ext.commands.converter import CONVERTER_MAPPING
241241

242242
if input_type not in CONVERTER_MAPPING:
243243
raise exc

discord/enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,8 @@ def from_datatype(cls, datatype):
833833
if issubclass(datatype, float):
834834
return cls.number
835835

836-
from .commands.context import ApplicationContext # noqa: PLC0415
837-
from .ext.bridge import BridgeContext # noqa: PLC0415
836+
from .commands.context import ApplicationContext
837+
from .ext.bridge import BridgeContext
838838

839839
if not issubclass(
840840
datatype, (ApplicationContext, BridgeContext)

discord/ext/bridge/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def predicate(func: Callable | ApplicationCommand):
492492
else:
493493
func.__guild_only__ = True
494494

495-
from ..commands import guild_only # noqa: PLC0415
495+
from ..commands import guild_only
496496

497497
return guild_only()(func)
498498

@@ -516,7 +516,7 @@ def predicate(func: Callable | ApplicationCommand):
516516
else:
517517
func.__nsfw__ = True
518518

519-
from ..commands import is_nsfw # noqa: PLC0415
519+
from ..commands import is_nsfw
520520

521521
return is_nsfw()(func)
522522

@@ -538,7 +538,7 @@ def has_permissions(**perms: bool):
538538
"""
539539

540540
def predicate(func: Callable | ApplicationCommand):
541-
from ..commands import has_permissions # noqa: PLC0415
541+
from ..commands import has_permissions
542542

543543
func = has_permissions(**perms)(func)
544544
_perms = Permissions(**perms)

discord/ext/commands/cog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def walk_commands(self) -> Generator[Command]:
5858
Union[:class:`.Command`, :class:`.Group`]
5959
A command or group from the cog.
6060
"""
61-
from .core import GroupMixin # noqa: PLC0415
61+
from .core import GroupMixin
6262

6363
for command in self.__cog_commands__:
6464
if not isinstance(command, ApplicationCommand):

0 commit comments

Comments
 (0)