Skip to content

Commit 3d17675

Browse files
committed
Ruff fixes for Python 3.14 and Ruff 0.14.2
1 parent b8a6663 commit 3d17675

File tree

13 files changed

+22
-21
lines changed

13 files changed

+22
-21
lines changed

bot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
apply_monkey_patches()
1919

20-
instance: "Bot" = None # Global Bot instance.
20+
instance: Bot = None # Global Bot instance.

bot/exts/backend/sync/_syncers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ async def _sync(diff: _Diff) -> None:
225225
# Using asyncio.gather would still consume too many resources on the site.
226226
log.trace("Syncing created users...")
227227
if diff.created:
228-
for chunk in batched(diff.created, CHUNK_SIZE):
228+
for chunk in batched(diff.created, CHUNK_SIZE, strict=False):
229229
await bot.instance.api_client.post("bot/users", json=chunk)
230230

231231
log.trace("Syncing updated users...")
232232
if diff.updated:
233-
for chunk in batched(diff.updated, CHUNK_SIZE):
233+
for chunk in batched(diff.updated, CHUNK_SIZE, strict=False):
234234
await bot.instance.api_client.patch("bot/users/bulk_patch", json=chunk)

bot/exts/filtering/_filter_lists/antispam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AntispamList(UniquesListBase):
4040

4141
name = "antispam"
4242

43-
def __init__(self, filtering_cog: "Filtering"):
43+
def __init__(self, filtering_cog: Filtering):
4444
super().__init__(filtering_cog)
4545
self.message_deletion_queue: dict[Member, DeletionContext] = dict()
4646

bot/exts/filtering/_filter_lists/filter_list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def _create_filter_list_result(
9090
self, ctx: FilterContext, defaults: Defaults, filters: Iterable[Filter]
9191
) -> list[Filter]:
9292
"""A helper function to evaluate the result of `filter_list_result`."""
93-
passed_by_default, failed_by_default = defaults.validations.evaluate(ctx)
93+
_passed_by_default, failed_by_default = defaults.validations.evaluate(ctx)
9494
default_answer = not bool(failed_by_default)
9595

9696
relevant_filters = []
@@ -160,7 +160,7 @@ def __hash__(self):
160160
T = typing.TypeVar("T", bound=Filter)
161161

162162

163-
class FilterList(dict[ListType, AtomicList], typing.Generic[T], FieldRequiring):
163+
class FilterList[T](dict[ListType, AtomicList], FieldRequiring):
164164
"""Dispatches events to lists of _filters, and aggregates the responses into a single list of actions to take."""
165165

166166
# Each subclass must define a name matching the filter_list name we're expecting to receive from the database.
@@ -268,7 +268,7 @@ class UniquesListBase(FilterList[UniqueFilter], ABC):
268268
Each unique filter subscribes to a subset of events to respond to.
269269
"""
270270

271-
def __init__(self, filtering_cog: "Filtering"):
271+
def __init__(self, filtering_cog: Filtering):
272272
super().__init__()
273273
self.filtering_cog = filtering_cog
274274
self.loaded_types: dict[str, type[UniqueFilter]] = {}

bot/exts/filtering/_ui/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ async def update_embed(
293293
if setting_name:
294294
# Find the right dictionary to update.
295295
if "/" in setting_name:
296-
filter_name, setting_name = setting_name.split("/", maxsplit=1)
296+
_filter_name, setting_name = setting_name.split("/", maxsplit=1)
297297
dict_to_edit = self.filter_settings_overrides
298298
default_value = self.filter_type.extra_fields_type().model_dump()[setting_name]
299299
else:

bot/exts/filtering/_ui/search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def template_settings(
114114
result = get_filter(filter_id, filter_lists)
115115
if not result:
116116
raise BadArgument(f"Could not find a filter with ID `{filter_id}`.")
117-
filter_, filter_list, list_type = result
117+
filter_, _filter_list, _list_type = result
118118

119119
if filter_type and not isinstance(filter_, filter_type):
120120
raise BadArgument(f"The filter with ID `{filter_id}` is not of type {filter_type.name!r}.")
@@ -256,7 +256,7 @@ async def update_embed(
256256
return
257257

258258
if "/" in setting_name:
259-
filter_name, setting_name = setting_name.split("/", maxsplit=1)
259+
_filter_name, setting_name = setting_name.split("/", maxsplit=1)
260260
dict_to_edit = self.filter_settings
261261
else:
262262
dict_to_edit = self.settings

bot/exts/filtering/_ui/ui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def populate_embed_from_dict(embed: Embed, data: dict) -> None:
136136
embed.add_field(name=setting, value=value, inline=len(value) < MAX_INLINE_SIZE)
137137

138138

139-
def parse_value(value: str, type_: type[T]) -> T:
139+
def parse_value[T](value: str, type_: type[T]) -> T:
140140
"""Parse the value provided in the CLI and attempt to convert it to the provided type."""
141141
blank = value == '""'
142142
type_ = normalize_type(type_, prioritize_nonetype=blank)

bot/exts/filtering/_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
Serializable = bool | int | float | str | list | dict | None
3535

3636

37-
def subclasses_in_package(package: str, prefix: str, parent: T) -> set[T]:
37+
def subclasses_in_package[T](package: str, prefix: str, parent: T) -> set[T]:
3838
"""Return all the subclasses of class `parent`, found in the top-level of `package`, given by absolute path."""
3939
subclasses = set()
4040

@@ -157,7 +157,7 @@ def normalize_type(type_: type, *, prioritize_nonetype: bool = True) -> type:
157157
return type_
158158

159159

160-
def starting_value(type_: type[T]) -> T:
160+
def starting_value[T](type_: type[T]) -> T:
161161
"""Return a value of the given type."""
162162
type_ = normalize_type(type_)
163163
try:

bot/exts/recruitment/talentpool/_cog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class NominationContextModal(discord.ui.Modal, title="New Nomination"):
4141
max_length=REASON_MAX_CHARS - 110
4242
)
4343

44-
def __init__(self, cog: "TalentPool", message: discord.Message, noms_channel: discord.TextChannel):
44+
def __init__(self, cog: TalentPool, message: discord.Message, noms_channel: discord.TextChannel):
4545
self.message = message
4646
self.api = cog.api
4747
self.noms_channel = noms_channel

bot/exts/utils/reminders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def cancel(self, interaction: Interaction, button: discord.ui.Button) -> N
8282
class OptInReminderMentionView(discord.ui.View):
8383
"""A button to opt-in to get notified of someone else's reminder."""
8484

85-
def __init__(self, cog: "Reminders", reminder: dict, expiration: Duration):
85+
def __init__(self, cog: Reminders, reminder: dict, expiration: Duration):
8686
super().__init__()
8787

8888
self.cog = cog

0 commit comments

Comments
 (0)