From 1a123bc25ddac77ad3bd262f2b4ba26834090494 Mon Sep 17 00:00:00 2001 From: Adriene Hutchins Date: Wed, 8 Apr 2020 18:37:22 -0400 Subject: [PATCH] Good citizen stuff for pylint --- extensions/botlist.py | 4 +-- extensions/core.py | 4 +-- extensions/models/help.py | 29 +++++++++++-------- ...earchExceptions.py => searchexceptions.py} | 0 extensions/specialty.py | 3 +- extensions/utils/logging.py | 2 +- 6 files changed, 23 insertions(+), 19 deletions(-) rename extensions/models/{SearchExceptions.py => searchexceptions.py} (100%) diff --git a/extensions/botlist.py b/extensions/botlist.py index 09d9660..c51e4a4 100644 --- a/extensions/botlist.py +++ b/extensions/botlist.py @@ -36,7 +36,7 @@ class BotList(commands.Cog, name='Bot List'): self.bot, self.dbl_token) # Start update loop - self.update_stats.start() + self.update_stats.start() # pylint: disable=no-member async def _update_logic(self): """Handles all statistic updating for various different bot lists.""" @@ -168,7 +168,7 @@ class BotList(commands.Cog, name='Bot List'): await self._update_logic() def cog_unload(self): - self.update_stats.cancel() + self.update_stats.cancel() # pylint: disable=no-member def setup(bot): diff --git a/extensions/core.py b/extensions/core.py index 76ae418..28d75b2 100644 --- a/extensions/core.py +++ b/extensions/core.py @@ -343,7 +343,7 @@ Guild count: {len(self.bot.guilds)} "You wish to use me in!_" ) - await guild.owner.send(guild_msg) + await owner.send(guild_msg) return # Ends here if there are no good channels to send to # Owner Disclosure @@ -362,7 +362,7 @@ Guild count: {len(self.bot.guilds)} ) # Send owner disclosure - await guild.owner.send(owner_msg) + await owner.send(owner_msg) def setup(bot): diff --git a/extensions/models/help.py b/extensions/models/help.py index 98798bd..dbaf9d3 100644 --- a/extensions/models/help.py +++ b/extensions/models/help.py @@ -5,9 +5,11 @@ '''HelpCmd File''' +import itertools + import discord from discord.ext import commands -import itertools + class TaciHelpCommand(commands.MinimalHelpCommand): def __init__(self, **options): @@ -105,13 +107,14 @@ class TaciHelpCommand(commands.MinimalHelpCommand): if heading == '\U0001F4E6 Core': # `command1`, `command2`, `command3` # On Same Line - self.paginator.add_line(", ".join(f"`{c.name}`" for c in commands)) + self.paginator.add_line( + ", ".join(f"`{c.name}`" for c in commands)) else: # `command` - description # On new lines for c in commands: self.paginator.add_line(f"`{c.name}` - {c.short_doc}") - + # New Line self.paginator.add_line() @@ -130,8 +133,8 @@ class TaciHelpCommand(commands.MinimalHelpCommand): self.paginator.add_line(note, empty=True) # Gets the category for each command in the bot - no_category = f"\u200b{self.no_category}" - def get_category(command, *, no_category=no_category): + def get_category(command, *, + no_category = f"\u200b{self.no_category}"): cog = command.cog if cog is not None: return f"{cog.emoji} {cog.qualified_name}" if cog.emoji else cog.qualified_name @@ -144,12 +147,13 @@ class TaciHelpCommand(commands.MinimalHelpCommand): # Splits Bot List and Core commands out of the others for category, commands in to_iterate: - commands = sorted(commands, key=lambda c: c.name) if self.sort_commands else list(commands) + commands = sorted( + commands, key=lambda c: c.name) if self.sort_commands else list(commands) if category in ['\U0001F4E6 Core', '\U0001F5F3 Bot List']: - main_cmds.extend(commands) + main_cmds.extend(commands) else: other_cmds[category] = commands - + # Core/Bot List commands become compacted self.add_bot_commands_formatting(main_cmds, '\U0001F4E6 Core') @@ -197,7 +201,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand): # Sends the completed help output await self.send_pages() - async def send_group_help(self, group): + async def send_group_help(self, group): """Sends the help for a command group.""" # Adds the header if there @@ -206,7 +210,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand): self.paginator.add_line(note, empty=True) # New Line - # Adds the formatting for the main group command + # Adds the formatting for the main group command self.add_command_formatting(group) # Adds any subcommands @@ -218,7 +222,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand): for command in filtered: self.add_subcommand_formatting(command) - # Adds the footer if there + # Adds the footer if there note = self.get_ending_note() if note: self.paginator.add_line() # New Line @@ -248,6 +252,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand): self.paginator.close_page() # TODO What does this do? await self.send_pages() + def setup(bot): """Lets helpcmd be added and reloaded as an extension.""" - pass \ No newline at end of file + pass diff --git a/extensions/models/SearchExceptions.py b/extensions/models/searchexceptions.py similarity index 100% rename from extensions/models/SearchExceptions.py rename to extensions/models/searchexceptions.py diff --git a/extensions/specialty.py b/extensions/specialty.py index 349e5a4..76899d5 100644 --- a/extensions/specialty.py +++ b/extensions/specialty.py @@ -135,8 +135,7 @@ class SpecialtySearch(commands.Cog, name="Specialty"): await ctx.send(f"**{title}** - <{url}>", embed=embed) - except Exception as e: - + except: aired = f"{anime['attributes']['startDate']}{thing}" template = f""" url: {url} diff --git a/extensions/utils/logging.py b/extensions/utils/logging.py index daea94f..9b9a8f0 100644 --- a/extensions/utils/logging.py +++ b/extensions/utils/logging.py @@ -5,10 +5,10 @@ '''Online File''' +import asyncio import traceback from typing import Optional -import asyncio import discord from discord.ext.commands import Context