Skip to content

Commit b30abc1

Browse files
Add local stubs to remove unused type-ignore comments (#635)
* Add local stubs to remove unused type-ignore comments * Update ping.py Signed-off-by: Matt Norton <matt@carrotmanmatt.com> --------- Signed-off-by: Matt Norton <matt@carrotmanmatt.com> Co-authored-by: automatic-pr-updater[bot] <217796550+automatic-pr-updater[bot]@users.noreply.github.com>
1 parent bbefbaf commit b30abc1

25 files changed

Lines changed: 351 additions & 134 deletions

cogs/add_users_to_threads_and_channels.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ async def add_users_or_roles_with_ping(
167167
@capture_guild_does_not_exist_error
168168
async def on_thread_create(self, thread: discord.Thread) -> None:
169169
"""Add users to a thread when it is created."""
170-
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
170+
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
171171
committee_role: discord.Role = await self.bot.committee_role
172172
committee_elect_role: discord.Role = await self.bot.committee_elect_role
173173

@@ -183,18 +183,18 @@ async def on_thread_create(self, thread: discord.Thread) -> None:
183183
users_or_roles=(committee_role, committee_elect_role), channel_or_thread=thread
184184
)
185185

186-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
186+
@discord.slash_command(
187187
name="add-users-to-channel", description="Adds selected users to a channel or thread."
188188
)
189-
@discord.option( # type: ignore[no-untyped-call, misc]
189+
@discord.option(
190190
name="user",
191191
description="The user to add to the channel.",
192192
input_type=str,
193193
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_members), # type: ignore[arg-type]
194194
required=True,
195195
parameter_name="user_id_str",
196196
)
197-
@discord.option( # type: ignore[no-untyped-call, misc]
197+
@discord.option(
198198
name="silent",
199199
description="Whether the users being added should be pinged or not.",
200200
input_type=bool,
@@ -203,7 +203,7 @@ async def on_thread_create(self, thread: discord.Thread) -> None:
203203
)
204204
@CommandChecks.check_interaction_user_has_committee_role
205205
@CommandChecks.check_interaction_user_in_main_guild
206-
async def add_user_to_channel( # type: ignore[misc]
206+
async def add_user_to_channel(
207207
self,
208208
ctx: "TeXBotApplicationContext",
209209
user_id_str: str,
@@ -237,19 +237,19 @@ async def add_user_to_channel( # type: ignore[misc]
237237
ephemeral=True,
238238
)
239239

240-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
240+
@discord.slash_command(
241241
name="add-role-to-channel",
242242
description="Adds the selected role and it's users to a channel or thread.",
243243
)
244-
@discord.option( # type: ignore[no-untyped-call, misc]
244+
@discord.option(
245245
name="role",
246246
description="The role to add to the channel.",
247247
input_type=str,
248248
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_roles), # type: ignore[arg-type]
249249
required=True,
250250
parameter_name="role_id_str",
251251
)
252-
@discord.option( # type: ignore[no-untyped-call, misc]
252+
@discord.option(
253253
name="silent",
254254
description="Whether the users being added should be pinged or not.",
255255
input_type=bool,
@@ -258,7 +258,7 @@ async def add_user_to_channel( # type: ignore[misc]
258258
)
259259
@CommandChecks.check_interaction_user_has_committee_role
260260
@CommandChecks.check_interaction_user_in_main_guild
261-
async def add_role_to_channel( # type: ignore[misc]
261+
async def add_role_to_channel(
262262
self,
263263
ctx: "TeXBotApplicationContext",
264264
role_id_str: str,

cogs/annual_handover_and_reset.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
class CommitteeHandoverCommandCog(TeXBotBaseCog):
3030
"""Cog class that defines the "/committee-handover" command."""
3131

32-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
32+
@discord.slash_command(
3333
name="committee-handover",
3434
description="Initiates the annual Discord handover procedure for new committee.",
3535
)
3636
@CommandChecks.check_interaction_user_has_committee_role
3737
@CommandChecks.check_interaction_user_in_main_guild
38-
async def committee_handover(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
38+
async def committee_handover(self, ctx: "TeXBotApplicationContext") -> None:
3939
"""
4040
Definition & callback response of the "committee_handover" command.
4141
@@ -48,7 +48,7 @@ async def committee_handover(self, ctx: "TeXBotApplicationContext") -> None: #
4848
4949
To do this, TeX-Bot will need to hold a role above that of the "Committee" role.
5050
"""
51-
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
51+
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
5252
main_guild: discord.Guild = self.bot.main_guild
5353
committee_role: discord.Role = await self.bot.committee_role
5454
committee_elect_role: discord.Role = await self.bot.committee_elect_role
@@ -177,21 +177,21 @@ class AnnualRolesResetCommandCog(TeXBotBaseCog):
177177
}
178178
)
179179

180-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
180+
@discord.slash_command(
181181
name="annual-roles-reset",
182182
description="Removes the @Member role and academic year roles from all users.",
183183
)
184184
@CommandChecks.check_interaction_user_has_committee_role
185185
@CommandChecks.check_interaction_user_in_main_guild
186-
async def annual_roles_reset(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
186+
async def annual_roles_reset(self, ctx: "TeXBotApplicationContext") -> None:
187187
"""
188188
Definition & callback response of the "annual_roles_reset" command.
189189
190190
The "annual_roles_reset" command removes the "Member" and academic year roles
191191
from any user that has them and subsequently deletes all instances of
192192
the GroupMadeMember database model.
193193
"""
194-
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
194+
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
195195
main_guild: discord.Guild = self.bot.main_guild
196196
member_role: discord.Role = await self.bot.member_role
197197

@@ -266,13 +266,13 @@ async def annual_roles_reset(self, ctx: "TeXBotApplicationContext") -> None: #
266266
class AnnualYearChannelsIncrementCommandCog(TeXBotBaseCog):
267267
"""Cog class that defines the "/increment-year-channels" command."""
268268

269-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
269+
@discord.slash_command(
270270
name="increment-year-channels",
271271
description="Increments the year channels, archiving and creating channels as needed.",
272272
)
273273
@CommandChecks.check_interaction_user_has_committee_role
274274
@CommandChecks.check_interaction_user_in_main_guild
275-
async def increment_year_channels(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
275+
async def increment_year_channels(self, ctx: "TeXBotApplicationContext") -> None:
276276
"""
277277
Definition and callback response of the "increment_year_channels" command.
278278
@@ -282,7 +282,7 @@ async def increment_year_channels(self, ctx: "TeXBotApplicationContext") -> None
282282
- Renames the current "first-years" channel to "second-years"
283283
- Creates a new "first-years" channel
284284
"""
285-
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
285+
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
286286
main_guild: discord.Guild = self.bot.main_guild
287287
guest_role: discord.Role = await self.bot.guest_role
288288
INCREMENT_YEAR_CHANNELS_AUDIT_MESSAGE: Final[str] = (

cogs/archive.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ async def autocomplete_get_non_archived_channels(
9797
)
9898
}
9999

100-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
100+
@discord.slash_command(
101101
name="archive-category", description="Archives the selected category."
102102
)
103-
@discord.option( # type: ignore[no-untyped-call, misc]
103+
@discord.option(
104104
name="category",
105105
description="The category to archive.",
106106
input_type=str,
@@ -110,7 +110,7 @@ async def autocomplete_get_non_archived_channels(
110110
required=True,
111111
parameter_name="str_category_id",
112112
)
113-
@discord.option( # type: ignore[no-untyped-call, misc]
113+
@discord.option(
114114
name="allow-archivist-access",
115115
description="Whether to allow archivists to access the category.",
116116
input_type=bool,
@@ -119,7 +119,7 @@ async def autocomplete_get_non_archived_channels(
119119
)
120120
@CommandChecks.check_interaction_user_has_committee_role
121121
@CommandChecks.check_interaction_user_in_main_guild
122-
async def archive_category( # type: ignore[misc]
122+
async def archive_category(
123123
self,
124124
ctx: "TeXBotApplicationContext",
125125
str_category_id: str,
@@ -132,7 +132,7 @@ async def archive_category( # type: ignore[misc]
132132
have the "Archivist" role. This can be overridden via a boolean parameter to allow
133133
for committee channels to be archived with the same command but not be visible.
134134
"""
135-
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
135+
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
136136
main_guild: discord.Guild = self.bot.main_guild
137137
archivist_role: discord.Role = await self.bot.archivist_role
138138

@@ -190,18 +190,18 @@ async def archive_category( # type: ignore[misc]
190190
content=f":white_check_mark: Category '{category.name}' successfully archived."
191191
)
192192

193-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
193+
@discord.slash_command(
194194
name="archive-channel", description="Archives the selected channel."
195195
)
196-
@discord.option( # type: ignore[no-untyped-call, misc]
196+
@discord.option(
197197
name="channel",
198198
description="The channel to archive.",
199199
input_type=str,
200200
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_non_archived_channels), # type: ignore[arg-type]
201201
required=True,
202202
parameter_name="str_channel_id",
203203
)
204-
@discord.option( # type: ignore[no-untyped-call, misc]
204+
@discord.option(
205205
name="category",
206206
description="The category to move the channel to.",
207207
input_type=str,
@@ -211,7 +211,7 @@ async def archive_category( # type: ignore[misc]
211211
)
212212
@CommandChecks.check_interaction_user_has_committee_role
213213
@CommandChecks.check_interaction_user_in_main_guild
214-
async def archive_channel( # type: ignore[misc]
214+
async def archive_channel(
215215
self, ctx: "TeXBotApplicationContext", str_channel_id: str, str_category_id: str
216216
) -> None:
217217
"""
@@ -220,7 +220,7 @@ async def archive_channel( # type: ignore[misc]
220220
The "archive-channel" command moves the channel into the selected category
221221
and syncs the permissions to the category's permissions.
222222
"""
223-
# NOTE: Shortcut accessors are placed at the top of the function, so that the exceptions they raise are displayed before any further errors may be sent
223+
# NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
224224
main_guild: discord.Guild = self.bot.main_guild
225225

226226
if not re.fullmatch(r"\A\d{17,20}\Z", str_channel_id):

cogs/check_su_platform_authorisation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,13 @@ async def get_su_platform_organisations(self) -> "Iterable[str]":
182182
class CheckSUPlatformAuthorisationCommandCog(CheckSUPlatformAuthorisationBaseCog):
183183
"""Cog class that defines the "/check-su-platform-authorisation" command."""
184184

185-
@discord.slash_command( # type: ignore[no-untyped-call, misc]
185+
@discord.slash_command(
186186
name="check-su-platform-authorisation",
187187
description="Checks the authorisation held by the SU platform access cookie.",
188188
)
189189
@CommandChecks.check_interaction_user_has_committee_role
190190
@CommandChecks.check_interaction_user_in_main_guild
191-
async def check_su_platform_authorisation(self, ctx: "TeXBotApplicationContext") -> None: # type: ignore[misc]
191+
async def check_su_platform_authorisation(self, ctx: "TeXBotApplicationContext") -> None:
192192
"""
193193
Definition of the "check_su_platform_authorisation" command.
194194

cogs/committee_actions_tracking.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,14 @@ async def autocomplete_get_action_status(
204204
@committee_actions.command(
205205
name="create", description="Adds a new action with the specified description."
206206
)
207-
@discord.option( # type: ignore[no-untyped-call, misc]
207+
@discord.option(
208208
name="description",
209209
description="The description of the action to assign.",
210210
input_type=str,
211211
required=True,
212212
parameter_name="action_description",
213213
)
214-
@discord.option( # type: ignore[no-untyped-call, misc]
214+
@discord.option(
215215
name="user",
216216
description="The user to assign the action to.",
217217
input_type=str,
@@ -266,15 +266,15 @@ async def create(
266266
@committee_actions.command(
267267
name="update-status", description="Update the status of the provided action."
268268
)
269-
@discord.option( # type: ignore[no-untyped-call, misc]
269+
@discord.option(
270270
name="action",
271271
description="The action to mark as completed.",
272272
input_type=str,
273273
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_user_action_ids), # type: ignore[arg-type]
274274
required=True,
275275
parameter_name="action_id",
276276
)
277-
@discord.option( # type: ignore[no-untyped-call, misc]
277+
@discord.option(
278278
name="status",
279279
description="The desired status of the action.",
280280
input_type=str,
@@ -338,15 +338,15 @@ async def update_status( # NOTE: Committee role check is not present because no
338338
@committee_actions.command(
339339
name="update-description", description="Update the description of the provided action."
340340
)
341-
@discord.option( # type: ignore[no-untyped-call, misc]
341+
@discord.option(
342342
name="action",
343343
description="The action to mark as completed.",
344344
input_type=str,
345345
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_user_action_ids), # type: ignore[arg-type]
346346
required=True,
347347
parameter_name="action_id",
348348
)
349-
@discord.option( # type: ignore[no-untyped-call, misc]
349+
@discord.option(
350350
name="description",
351351
description="The description to be used for the action",
352352
input_type=str,
@@ -400,7 +400,7 @@ async def update_description(
400400
name="action-random-user",
401401
description="Creates an action object with the specified description and random user.",
402402
)
403-
@discord.option( # type: ignore[no-untyped-call, misc]
403+
@discord.option(
404404
name="description",
405405
description="The description to be used for the action",
406406
input_type=str,
@@ -463,7 +463,7 @@ async def action_random_user(
463463
name="action-all-committee",
464464
description="Creates an action with the description for every committee member",
465465
)
466-
@discord.option( # type: ignore[no-untyped-call, misc]
466+
@discord.option(
467467
name="description",
468468
description="The description to be used for the actions",
469469
input_type=str,
@@ -528,7 +528,7 @@ async def action_all_committee(
528528
@committee_actions.command(
529529
name="list", description="Lists all actions for a specified user"
530530
)
531-
@discord.option( # type: ignore[no-untyped-call, misc]
531+
@discord.option(
532532
name="user",
533533
description="The user to list actions for.",
534534
input_type=str,
@@ -537,14 +537,14 @@ async def action_all_committee(
537537
default=None,
538538
parameter_name="action_member_id",
539539
)
540-
@discord.option( # type: ignore[no-untyped-call, misc]
540+
@discord.option(
541541
name="ping",
542542
description="Triggers whether the message pings users or not.",
543543
input_type=bool,
544544
default=False,
545545
required=False,
546546
)
547-
@discord.option( # type: ignore[no-untyped-call, misc]
547+
@discord.option(
548548
name="status",
549549
description="The desired status of the action.",
550550
input_type=str,
@@ -647,15 +647,15 @@ async def list_user_actions( # NOTE: Committee role check is not present becaus
647647
@committee_actions.command(
648648
name="reassign", description="Reassign the specified action to another user."
649649
)
650-
@discord.option( # type: ignore[no-untyped-call, misc]
650+
@discord.option(
651651
name="action",
652652
description="The action to reassign.",
653653
input_type=str,
654654
autocomplete=discord.utils.basic_autocomplete(autocomplete_get_user_action_ids), # type: ignore[arg-type]
655655
required=True,
656656
parameter_name="action_id",
657657
)
658-
@discord.option( # type: ignore[no-untyped-call, misc]
658+
@discord.option(
659659
name="user",
660660
description="The user to list actions for.",
661661
input_type=str,
@@ -724,14 +724,14 @@ async def reassign_action(
724724
return
725725

726726
@committee_actions.command(name="list-all", description="List all current actions.")
727-
@discord.option( # type: ignore[no-untyped-call, misc]
727+
@discord.option(
728728
name="ping",
729729
description="Triggers whether the message pings users or not.",
730730
input_type=bool,
731731
default=False,
732732
required=False,
733733
)
734-
@discord.option( # type: ignore[no-untyped-call, misc]
734+
@discord.option(
735735
name="status-filter",
736736
description="The filter to apply to the status of actions.",
737737
input_type=str,
@@ -795,7 +795,7 @@ async def list_all_actions(
795795
@committee_actions.command(
796796
name="delete", description="Deletes the specified action from the database completely."
797797
)
798-
@discord.option( # type: ignore[no-untyped-call, misc]
798+
@discord.option(
799799
name="action",
800800
description="The action to delete.",
801801
input_type=str,
@@ -841,13 +841,13 @@ async def delete_action(self, ctx: "TeXBotApplicationContext", action_id: str) -
841841
class CommitteeActionsTrackingContextCommandsCog(CommitteeActionsTrackingBaseCog):
842842
"""Cog class to define the actions tracking message context commands."""
843843

844-
@discord.message_command( # type: ignore[no-untyped-call, misc]
844+
@discord.message_command(
845845
name="Action Message Author",
846846
description="Creates a new action for the message author using the message content.",
847847
)
848848
@CommandChecks.check_interaction_user_has_committee_role
849849
@CommandChecks.check_interaction_user_in_main_guild
850-
async def action_message_author( # type: ignore[misc]
850+
async def action_message_author(
851851
self, ctx: "TeXBotApplicationContext", message: discord.Message
852852
) -> None:
853853
"""

0 commit comments

Comments
 (0)