From d2df32ddaf7c285da518de6d4074e599e5159664 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Sun, 24 Sep 2023 17:16:32 -0400 Subject: [PATCH] fix(issues): pylint fixes --- issues/issues.py | 18 +++++++++--------- issues/modals.py | 22 ++++++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/issues/issues.py b/issues/issues.py index 8ce6f65..800fb87 100644 --- a/issues/issues.py +++ b/issues/issues.py @@ -39,11 +39,11 @@ class Issues(commands.Cog): channel = self.bot.get_channel(await self.config.request_channel()) if channel is None: await original_interaction.edit_original_response(content="Command cancelled.", view=None) - await interaction.response.send_message(content=f"The cog is misconfigured, please report this error.", ephemeral=True) + await interaction.response.send_message(content="The cog is misconfigured, please report this error.", ephemeral=True) try: message = await channel.send(content=".") await message.edit(content="", embed=embed, view=self.IssueResponseButtons(channel, message.id, interaction.user)) - await original_interaction.edit_original_response(content=f"Issue request sent!", embed=embed, view=None) + await original_interaction.edit_original_response(content="Issue request sent!", embed=embed, view=None) await interaction.response.defer() except (discord.HTTPException, discord.Forbidden) as error: await original_interaction.edit_original_response(content="Command cancelled.", view=None) @@ -57,19 +57,19 @@ class Issues(commands.Cog): self.original_interaction = original_interaction @discord.ui.button(label="Bot Bug", style=discord.ButtonStyle.danger) - async def issue_button_bot_bug(self, interaction: discord.Interaction, button: discord.ui.Button): + async def issue_button_bot_bug(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument await interaction.response.send_modal(modals.BotBugModal(self.color, self.cog_instance, self.original_interaction)) @discord.ui.button(label="Cog Bug", style=discord.ButtonStyle.danger) - async def issue_button_cog_bug(self, interaction: discord.Interaction, button: discord.ui.Button): + async def issue_button_cog_bug(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument await interaction.response.send_modal(modals.CogBugModal(self.color, self.cog_instance, self.original_interaction)) @discord.ui.button(label="Bot Suggestion", style=discord.ButtonStyle.blurple) - async def issue_button_bot_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button): + async def issue_button_bot_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument await interaction.response.send_modal(modals.BotSuggestionModal(self.color, self.cog_instance, self.original_interaction)) @discord.ui.button(label="Cog Suggestion", style=discord.ButtonStyle.blurple) - async def issue_button_cog_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button): + async def issue_button_cog_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument await interaction.response.send_modal(modals.CogSuggestionModal(self.color, self.cog_instance, self.original_interaction)) class IssueConfigurationButton(discord.ui.View): @@ -79,7 +79,7 @@ class Issues(commands.Cog): self.ctx = ctx @discord.ui.button(label="Change Configuration", style=discord.ButtonStyle.blurple, row=0) - async def issue_configuration_button(self, interaction: discord.Interaction, button: discord.ui.Button): + async def issue_configuration_button(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument await interaction.response.send_modal(modals.IssuesConfigurationModal(self.config, self.ctx)) class IssueResponseButtons(discord.ui.View): @@ -90,9 +90,9 @@ class Issues(commands.Cog): self.user = user @discord.ui.button(label="Approve", style=discord.ButtonStyle.green) - async def issue_response_button_approve(self, interaction: discord.Interaction, button: discord.ui.Button): + async def issue_response_button_approve(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument await interaction.response.send_modal(modals.IssueResponseModal(self.channel, self.message_id, self.user, True)) @discord.ui.button(label="Deny", style=discord.ButtonStyle.danger) - async def issue_response_button_deny(self, interaction: discord.Interaction, button: discord.ui.Button): + async def issue_response_button_deny(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument await interaction.response.send_modal(modals.IssueResponseModal(self.channel, self.message_id, self.user, False)) diff --git a/issues/modals.py b/issues/modals.py index 98d8358..c845eef 100644 --- a/issues/modals.py +++ b/issues/modals.py @@ -2,6 +2,8 @@ import aiohttp import discord from redbot.core import Config +# pylint: disable=arguments-differ + # # Misc. functions # @@ -297,16 +299,16 @@ class IssueResponseModal(discord.ui.Modal, title="Sending response message..."): [f"{name}\n{value}" for name, value in zip(field_names, field_values)] ) - async def fetch_labels(): - async with aiohttp.ClientSession(headers=headers) as session: - async with session.post(url=f"{await self.config.gitea_root_url()}/api/v1/repos/{await self.config.gitea_repository_owner()}/{await self.config.gitea_repository()}/labels") as response: - label_list = [] - for label in response.json(): - if label["name"] in desired_labels: - label_list.append(label["id"]) - if label_list is None: - print("Error! Labels are not properly configured on the target repository.") - return await label_list + # async def fetch_labels(): + # async with aiohttp.ClientSession(headers=headers) as session: + # async with session.post(url=f"{await self.config.gitea_root_url()}/api/v1/repos/{await self.config.gitea_repository_owner()}/{await self.config.gitea_repository()}/labels") as response: + # label_list = [] + # for label in response.json(): + # if label["name"] in desired_labels: + # label_list.append(label["id"]) + # if label_list is None: + # print("Error! Labels are not properly configured on the target repository.") + # return await label_list issue_labels = None