Run ruff linter with autofixing.

This commit is contained in:
2024-05-22 15:18:44 -04:00
parent 796b052bfc
commit ccbe86623a
22 changed files with 22 additions and 72 deletions
-1
View File
@@ -19,7 +19,6 @@ def setup(bot: commands.Bot):
"""
Adds all command classes to bot.
"""
bot.add_cog(RecordCog(bot))
bot.add_cog(RefreshCog(bot))
bot.add_cog(RemoveCog())
-2
View File
@@ -47,7 +47,6 @@ class RecordCog(commands.Cog, name="Record Commands"):
name (str): Name of the event.
host (nextcord.Member, optional): Alternative host to user using command.
"""
# check role
if interaction.guild.get_role(self.bot.config.params.event_host_role_id) not in interaction.user.roles:
await interaction.response.send_message(
@@ -110,7 +109,6 @@ class EventView(nextcord.ui.View):
Submits the event embed to the event channel. Removes view and embed from recording message.
Sends point information to database.
"""
discord_users = self.event_participants.values.members
if discord_users:
discord_users_list: list[str] = [str(user.id) for user in discord_users if user.id is not self.host_id]
-2
View File
@@ -41,7 +41,6 @@ class RemoveCog(commands.Cog, name="Remove Commands"):
interaction (nextcord.Interaction): Interaction that invoked the command.
presence (str): Is SlashOption. The presence to remove. Is the ID of the presence.
"""
presence_id = int(presence_str)
with Session(engine) as session:
stmt = delete(Presences).where(Presences.Id == presence_id)
@@ -60,7 +59,6 @@ class RemoveCog(commands.Cog, name="Remove Commands"):
interaction (nextcord.Interaction): Interaction with command.
presence_str (str): String to run autocomplete on.
"""
with Session(engine) as session:
stmt = select(Presences)
presences_dict: "dict[str,str]" = {pres.Presence: str(pres.Id) for pres in session.scalars(stmt)}
-3
View File
@@ -45,7 +45,6 @@ class RequestCog(commands.Cog, name="Request Commands"):
interaction (nextcord.Interaction): Interaction that invoked the command.
presence (str): The presence to add.
"""
config: DakinyConfig = self.bot.config
content = f'<@{interaction.user.id}> would like to add presence "{presence}."'
view = PresenceChange(presence)
@@ -70,7 +69,6 @@ class RequestCog(commands.Cog, name="Request Commands"):
interaction (nextcord.Interaction): Interaction that invoked the command.
new_username(str): The username to change to.
"""
config: DakinyConfig = self.bot.config
content = f'<@{interaction.user.id}> would like to change their username to "{new_nickname}."'
view = UsernameRequest(interaction.user.id, new_nickname)
@@ -160,7 +158,6 @@ class PresenceChange(nextcord.ui.View):
button (nextcord.ui.Button): Unused.
interaction (nextcord.Interaction): The interaction of the user clicking the button.
"""
with Session(engine) as session:
session.add(Presences(Presence=self.presence))
session.commit()
-1
View File
@@ -45,7 +45,6 @@ class setCog(commands.Cog, name="Set Commands"):
month (int, optional): The month a user was born. Is SlashOption.
day (int, optional): The day a user was born. Is SlashOption.
"""
# Must be deferred, apparently datetime takes a little bit on invalid dates.
await interaction.response.defer(ephemeral=True)
-1
View File
@@ -47,7 +47,6 @@ class TestCog(commands.Cog, name="Test commands."):
Args:
interaction (nextcord.Interaction): _description_
"""
config: DakinyConfig = self.bot.config
cycle = ElectionCycle(
get_current_election_cycle(config),
-4
View File
@@ -104,7 +104,6 @@ class ViewCog(commands.Cog, name="View Commands"):
Args:
interaction (nextcord.Integration): User's interaction with the command.
"""
# might take a while depending on number of presences
await interaction.response.defer(ephemeral=True)
@@ -141,7 +140,6 @@ class ViewCog(commands.Cog, name="View Commands"):
interaction (nextcord.Interaction): User's interaction with the command.
election_name (str): Is SlashOption. The name of the election to view votes for.
"""
stmt = select(Votes).where(Votes.ElectionCycle == election_name).where(Votes.Type == election_type)
with Session(engine) as session:
@@ -170,7 +168,6 @@ class ViewCog(commands.Cog, name="View Commands"):
interaction (nextcord.Interaction): Interaction with command.
election_name (str): String to run autocomplete on.
"""
with Session(engine) as session:
stmt = select(Votes.ElectionCycle).distinct()
elections = session.scalars(stmt)
@@ -194,7 +191,6 @@ class ViewCog(commands.Cog, name="View Commands"):
interaction (nextcord.Interaction): Interaction with command.
quarter_name (str): String to run autocomplete on.
"""
with Session(engine) as session:
stmt = select(ParticipationPoints.Cycle).distinct()
quarters = session.scalars(stmt)