From faebd2629c9ff93f946a86f06813aac1656a938b Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 18 Dec 2023 19:00:16 -0500 Subject: [PATCH] fix(moderation): pylint fixes --- .forgejo/workflows/config/.pylintrc | 5 ++++- moderation/importers/moderation.py | 2 +- moderation/moderation.py | 2 +- moderation/utilities/config.py | 8 ++++---- moderation/utilities/utils.py | 1 - 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.forgejo/workflows/config/.pylintrc b/.forgejo/workflows/config/.pylintrc index 567675b..dbe3392 100644 --- a/.forgejo/workflows/config/.pylintrc +++ b/.forgejo/workflows/config/.pylintrc @@ -14,4 +14,7 @@ too-many-statements, arguments-differ, too-many-return-statements, - import-outside-toplevel + import-outside-toplevel, + import-self, + relative-beyond-top-level, + duplicate-code diff --git a/moderation/importers/moderation.py b/moderation/importers/moderation.py index 28303f6..aaf2c9b 100644 --- a/moderation/importers/moderation.py +++ b/moderation/importers/moderation.py @@ -1,5 +1,5 @@ import json -from datetime import datetime, timedelta +from datetime import timedelta from typing import Dict from discord import ButtonStyle, Interaction, Message, ui diff --git a/moderation/moderation.py b/moderation/moderation.py index 0402029..6b702b2 100644 --- a/moderation/moderation.py +++ b/moderation/moderation.py @@ -1018,7 +1018,7 @@ class Moderation(commands.Cog): for target_id, moderation_id, role_id in zip(target_ids, moderation_ids, role_ids): try: - member: discord.Member = await guild.fetch_member(target_id) + # member: discord.Member = await guild.fetch_member(target_id) role: discord.Role = guild.get_role(role_id) if role is None: diff --git a/moderation/utilities/config.py b/moderation/utilities/config.py index 5c89788..02d7c73 100644 --- a/moderation/utilities/config.py +++ b/moderation/utilities/config.py @@ -2,14 +2,14 @@ from redbot.core import Config config: Config = Config.get_conf(None, identifier=481923957134912, cog_name="Moderation") -def register_config(config: Config): - config.register_global( +def register_config(config_obj: Config): + config_obj.register_global( mysql_address= " ", mysql_database = " ", mysql_username = " ", mysql_password = " " ) - config.register_guild( + config_obj.register_guild( use_discord_permissions = True, ignore_other_bots = True, dm_users = True, @@ -22,7 +22,7 @@ def register_config(config: Config): auto_evidenceformat = False, blacklist_roles = [] ) - config.register_user( + config_obj.register_user( history_ephemeral = None, history_inline = None, history_pagesize = None, diff --git a/moderation/utilities/utils.py b/moderation/utilities/utils.py index 1e61002..49f4106 100644 --- a/moderation/utilities/utils.py +++ b/moderation/utilities/utils.py @@ -221,7 +221,6 @@ async def log(interaction: Interaction, moderation_id: int, resolved: bool = Fal async def send_evidenceformat(interaction: Interaction, case_dict: dict): """This function sends an ephemeral message to the moderator who took the moderation action, with a pre-made codeblock for use in the mod-evidence channel.""" from .embed_factory import embed_factory - from .config import config send_evidence_bool = (await config.user(interaction.user).auto_evidenceformat() or await config.guild(interaction.guild).auto_evidenceformat()