Skip to content

Commit b58f2e3

Browse files
committed
🚨 add noqa comments to prevent linting errors
1 parent 9755fe8 commit b58f2e3

File tree

15 files changed

+52
-52
lines changed

15 files changed

+52
-52
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
- id: end-of-file-fixer
1212
exclude: \.(po|pot|yml|yaml)$
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.11.9
14+
rev: v0.12.0
1515
hooks:
1616
- id: ruff
1717
args: [ --fix ]

discord/channel.py

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

461-
from .webhook import Webhook
461+
from .webhook import Webhook # noqa: PLC0415
462462

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

499-
from .webhook import Webhook
499+
from .webhook import Webhook # noqa: PLC0415
500500

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

548-
from .webhook import Webhook
548+
from .webhook import Webhook # noqa: PLC0415
549549

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

572-
from .message import PartialMessage
572+
from .message import PartialMessage # noqa: PLC0415
573573

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

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

1742-
from .message import PartialMessage
1742+
from .message import PartialMessage # noqa: PLC0415
17431743

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

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

1897-
from .webhook import Webhook
1897+
from .webhook import Webhook # noqa: PLC0415
18981898

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

1935-
from .webhook import Webhook
1935+
from .webhook import Webhook # noqa: PLC0415
19361936

19371937
if avatar is not None:
19381938
avatar = bytes_to_base64_data(avatar) # type: ignore
@@ -2266,7 +2266,7 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
22662266
The partial message.
22672267
"""
22682268

2269-
from .message import PartialMessage
2269+
from .message import PartialMessage # noqa: PLC0415
22702270

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

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

2424-
from .webhook import Webhook
2424+
from .webhook import Webhook # noqa: PLC0415
24252425

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

2462-
from .webhook import Webhook
2462+
from .webhook import Webhook # noqa: PLC0415
24632463

24642464
if avatar is not None:
24652465
avatar = bytes_to_base64_data(avatar) # type: ignore
@@ -3050,7 +3050,7 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
30503050
The partial message.
30513051
"""
30523052

3053-
from .message import PartialMessage
3053+
from .message import PartialMessage # noqa: PLC0415
30543054

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

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

3276-
from .message import PartialMessage
3276+
from .message import PartialMessage # noqa: PLC0415
32773277

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

discord/client.py

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

983983
channel = self._connection.get_channel(id)
984984

discord/commands/core.py

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

112112

113113
def wrap_callback(coro):
114-
from ..ext.commands.errors import CommandError
114+
from ..ext.commands.errors import CommandError # noqa: PLC0415
115115

116116
@functools.wraps(coro)
117117
async def wrapped(*args, **kwargs):
@@ -131,7 +131,7 @@ async def wrapped(*args, **kwargs):
131131

132132

133133
def hooked_wrapped_callback(command, ctx, coro):
134-
from ..ext.commands.errors import CommandError
134+
from ..ext.commands.errors import CommandError # noqa: PLC0415
135135

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

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

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

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

332332
if retry_after:
333-
from ..ext.commands.errors import CommandOnCooldown
333+
from ..ext.commands.errors import CommandOnCooldown # noqa: PLC0415
334334

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

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

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

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

12091209
# similar to ApplicationCommand
1210-
from ..ext.commands.cooldowns import BucketType, CooldownMapping, MaxConcurrency
1210+
from ..ext.commands.cooldowns import BucketType, CooldownMapping, MaxConcurrency # noqa: PLC0415
12111211

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

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
227+
from ..ext.commands import Converter # noqa: PLC0415
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
240+
from ..ext.commands.converter import CONVERTER_MAPPING # noqa: PLC0415
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
837-
from .ext.bridge import BridgeContext
836+
from .commands.context import ApplicationContext # noqa: PLC0415
837+
from .ext.bridge import BridgeContext # noqa: PLC0415
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
@@ -493,7 +493,7 @@ def predicate(func: Callable | ApplicationCommand):
493493
else:
494494
func.__guild_only__ = True
495495

496-
from ..commands import guild_only
496+
from ..commands import guild_only # noqa: PLC0415
497497

498498
return guild_only()(func)
499499

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

520-
from ..commands import is_nsfw
520+
from ..commands import is_nsfw # noqa: PLC0415
521521

522522
return is_nsfw()(func)
523523

@@ -539,7 +539,7 @@ def has_permissions(**perms: bool):
539539
"""
540540

541541
def predicate(func: Callable | ApplicationCommand):
542-
from ..commands import has_permissions
542+
from ..commands import has_permissions # noqa: PLC0415
543543

544544
func = has_permissions(**perms)(func)
545545
_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
61+
from .core import GroupMixin # noqa: PLC0415
6262

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

discord/ext/commands/context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ async def send_help(self, *args: Any) -> Any:
348348
Any
349349
The result of the help command, if any.
350350
"""
351-
from .core import Command, Group, wrap_callback
352-
from .errors import CommandError
351+
from .core import Command, Group, wrap_callback # noqa: PLC0415
352+
from .errors import CommandError # noqa: PLC0415
353353

354354
bot = self.bot
355355
cmd = bot.help_command

discord/ext/commands/help.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ async def filter_commands(self, commands, *, sort=False, key=None, exclude: tupl
571571
key = lambda c: c.name
572572

573573
# Ignore Application Commands because they don't have hidden/docs
574-
from ...commands import ApplicationCommand
574+
from ...commands import ApplicationCommand # noqa: PLC0415
575575

576576
new_commands = [
577577
command
@@ -1083,7 +1083,7 @@ async def send_group_help(self, group):
10831083
await self.send_pages()
10841084

10851085
async def send_cog_help(self, cog):
1086-
from discord.ext.bridge import BridgeExtCommand
1086+
from discord.ext.bridge import BridgeExtCommand # noqa: PLC0415
10871087

10881088
if cog.description:
10891089
self.paginator.add_line(cog.description, empty=True)
@@ -1317,7 +1317,7 @@ def get_category(command, *, no_category=no_category):
13171317
await self.send_pages()
13181318

13191319
async def send_cog_help(self, cog):
1320-
from discord.ext.bridge import BridgeExtCommand
1320+
from discord.ext.bridge import BridgeExtCommand # noqa: PLC0415
13211321

13221322
bot = self.context.bot
13231323
if bot.description:

0 commit comments

Comments
 (0)