Skip to content

Commit b727e92

Browse files
committed
fix: Fix new ruff errors
1 parent 4dc1764 commit b727e92

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
- id: check-merge-conflict
3131
name: Merge Conflicts
3232
- repo: https://github.com/astral-sh/ruff-pre-commit
33-
rev: 'v0.4.3'
33+
rev: 'v0.11.10'
3434
hooks:
3535
- id: ruff
3636
args: [--fix, --exit-non-zero-on-fix]

interactions/api/gateway/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ConnectionState:
4141
gateway_url: str = MISSING
4242
"""The URL that the gateway should connect to."""
4343

44-
gateway_started: asyncio.Event = asyncio.Event()
44+
gateway_started: asyncio.Event = attrs.field(factory=asyncio.Event)
4545
"""Event to check if the gateway has been started."""
4646

4747
_shard_task: asyncio.Task | None = None

interactions/ext/paginators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Timeout:
4040
"""The paginator that this timeout is associated with."""
4141
run: bool = attrs.field(repr=False, default=True)
4242
"""Whether or not this timeout is currently running."""
43-
ping: asyncio.Event = asyncio.Event()
43+
ping: asyncio.Event = attrs.field(factory=asyncio.Event)
4444
"""The event that is used to wait the paginator action."""
4545

4646
async def __call__(self) -> None:

interactions/ext/prefixed_commands/command.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
from .context import PrefixedContext
3838

3939
__all__ = (
40-
"PrefixedCommandParameter",
4140
"PrefixedCommand",
41+
"PrefixedCommandParameter",
4242
"prefixed_command",
4343
)
4444

@@ -54,17 +54,17 @@ class PrefixedCommandParameter:
5454
"""
5555

5656
__slots__ = (
57-
"name",
58-
"default",
59-
"type",
60-
"kind",
57+
"consume_rest",
58+
"consume_rest_class",
6159
"converters",
60+
"default",
6261
"greedy",
62+
"kind",
63+
"name",
64+
"no_argument",
65+
"type",
6366
"union",
6467
"variable",
65-
"consume_rest",
66-
"consume_rest_class",
67-
"no_argument",
6868
)
6969

7070
name: str
@@ -232,9 +232,9 @@ async def _one_function_cmd(ctx, arg) -> Any:
232232
ValueError(f"{get_object_name(anno)} for {name} has 0 arguments, which is unsupported.")
233233
case _:
234234
ValueError(f"{get_object_name(anno)} for {name} has more than 2 arguments, which is unsupported.")
235-
elif anno == bool:
235+
elif anno is bool:
236236
return lambda ctx, arg: _convert_to_bool(arg)
237-
elif anno == inspect._empty:
237+
elif anno is inspect._empty:
238238
return lambda ctx, arg: str(arg)
239239
else:
240240
return lambda ctx, arg: anno(arg)
@@ -524,7 +524,7 @@ def _parse_parameters(self) -> None: # noqa: C901
524524
cmd_param.default = default
525525
cmd_param.greedy = True
526526

527-
if typing.get_origin(anno) == tuple:
527+
if typing.get_origin(anno) is tuple:
528528
if cmd_param.optional:
529529
# there's a lot of parser ambiguities here, so i'd rather not
530530
raise ValueError("Variable arguments cannot have default values or be Optional.")

interactions/models/discord/message.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@
5757
from interactions.client import Client
5858

5959
__all__ = (
60+
"AllowedMentions",
6061
"Attachment",
62+
"BaseMessage",
6163
"ChannelMention",
64+
"Message",
6265
"MessageActivity",
63-
"MessageReference",
6466
"MessageInteraction",
6567
"MessageInteractionMetadata",
66-
"AllowedMentions",
67-
"BaseMessage",
68-
"Message",
68+
"MessageReference",
6969
"MessageType",
7070
"process_allowed_mentions",
71-
"process_message_reference",
7271
"process_message_payload",
72+
"process_message_reference",
7373
)
7474

7575
channel_mention = re.compile(r"<#(?P<id>[0-9]{17,})>")
@@ -615,7 +615,7 @@ def _process_dict(cls, data: dict, client: "Client") -> dict: # noqa: C901
615615
return data
616616

617617
@property
618-
def system_content(self) -> Optional[str]:
618+
def system_content(self) -> Optional[str]: # noqa: C901
619619
"""Content for system messages. (boosts, welcomes, etc)"""
620620
match self.type:
621621
case MessageType.USER_PREMIUM_GUILD_SUBSCRIPTION:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ target-version = "py310"
114114
output-format = "concise" # set to full if you want to see the source of the error/warning
115115

116116
[tool.ruff.lint]
117-
ignore-init-module-imports = true
118117
task-tags = ["TODO", "FIXME", "XXX", "HACK", "REVIEW", "NOTE"]
119118
select = ["E", "F", "B", "Q", "RUF", "D", "ANN", "RET", "C"]
120119
ignore = [

0 commit comments

Comments
 (0)