Good citizen stuff for pylint

This commit is contained in:
Adriene Hutchins 2020-04-08 18:37:22 -04:00
parent 13e64461be
commit 1a123bc25d
6 changed files with 23 additions and 19 deletions

View File

@ -36,7 +36,7 @@ class BotList(commands.Cog, name='Bot List'):
self.bot, self.dbl_token) self.bot, self.dbl_token)
# Start update loop # Start update loop
self.update_stats.start() self.update_stats.start() # pylint: disable=no-member
async def _update_logic(self): async def _update_logic(self):
"""Handles all statistic updating for various different bot lists.""" """Handles all statistic updating for various different bot lists."""
@ -168,7 +168,7 @@ class BotList(commands.Cog, name='Bot List'):
await self._update_logic() await self._update_logic()
def cog_unload(self): def cog_unload(self):
self.update_stats.cancel() self.update_stats.cancel() # pylint: disable=no-member
def setup(bot): def setup(bot):

View File

@ -343,7 +343,7 @@ Guild count: {len(self.bot.guilds)}
"You wish to use me in!_" "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 return # Ends here if there are no good channels to send to
# Owner Disclosure # Owner Disclosure
@ -362,7 +362,7 @@ Guild count: {len(self.bot.guilds)}
) )
# Send owner disclosure # Send owner disclosure
await guild.owner.send(owner_msg) await owner.send(owner_msg)
def setup(bot): def setup(bot):

View File

@ -5,9 +5,11 @@
'''HelpCmd File''' '''HelpCmd File'''
import itertools
import discord import discord
from discord.ext import commands from discord.ext import commands
import itertools
class TaciHelpCommand(commands.MinimalHelpCommand): class TaciHelpCommand(commands.MinimalHelpCommand):
def __init__(self, **options): def __init__(self, **options):
@ -105,13 +107,14 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
if heading == '\U0001F4E6 Core': if heading == '\U0001F4E6 Core':
# `command1`, `command2`, `command3` # `command1`, `command2`, `command3`
# On Same Line # 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: else:
# `command` - description # `command` - description
# On new lines # On new lines
for c in commands: for c in commands:
self.paginator.add_line(f"`{c.name}` - {c.short_doc}") self.paginator.add_line(f"`{c.name}` - {c.short_doc}")
# New Line # New Line
self.paginator.add_line() self.paginator.add_line()
@ -130,8 +133,8 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
self.paginator.add_line(note, empty=True) self.paginator.add_line(note, empty=True)
# Gets the category for each command in the bot # Gets the category for each command in the bot
no_category = f"\u200b{self.no_category}" def get_category(command, *,
def get_category(command, *, no_category=no_category): no_category = f"\u200b{self.no_category}"):
cog = command.cog cog = command.cog
if cog is not None: if cog is not None:
return f"{cog.emoji} {cog.qualified_name}" if cog.emoji else cog.qualified_name 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 # Splits Bot List and Core commands out of the others
for category, commands in to_iterate: 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']: if category in ['\U0001F4E6 Core', '\U0001F5F3 Bot List']:
main_cmds.extend(commands) main_cmds.extend(commands)
else: else:
other_cmds[category] = commands other_cmds[category] = commands
# Core/Bot List commands become compacted # Core/Bot List commands become compacted
self.add_bot_commands_formatting(main_cmds, '\U0001F4E6 Core') self.add_bot_commands_formatting(main_cmds, '\U0001F4E6 Core')
@ -197,7 +201,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
# Sends the completed help output # Sends the completed help output
await self.send_pages() 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.""" """Sends the help for a command group."""
# Adds the header if there # Adds the header if there
@ -206,7 +210,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
self.paginator.add_line(note, empty=True) self.paginator.add_line(note, empty=True)
# New Line # New Line
# Adds the formatting for the main group command # Adds the formatting for the main group command
self.add_command_formatting(group) self.add_command_formatting(group)
# Adds any subcommands # Adds any subcommands
@ -218,7 +222,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
for command in filtered: for command in filtered:
self.add_subcommand_formatting(command) self.add_subcommand_formatting(command)
# Adds the footer if there # Adds the footer if there
note = self.get_ending_note() note = self.get_ending_note()
if note: if note:
self.paginator.add_line() # New Line self.paginator.add_line() # New Line
@ -248,6 +252,7 @@ class TaciHelpCommand(commands.MinimalHelpCommand):
self.paginator.close_page() # TODO What does this do? self.paginator.close_page() # TODO What does this do?
await self.send_pages() await self.send_pages()
def setup(bot): def setup(bot):
"""Lets helpcmd be added and reloaded as an extension.""" """Lets helpcmd be added and reloaded as an extension."""
pass pass

View File

@ -135,8 +135,7 @@ class SpecialtySearch(commands.Cog, name="Specialty"):
await ctx.send(f"**{title}** - <{url}>", embed=embed) await ctx.send(f"**{title}** - <{url}>", embed=embed)
except Exception as e: except:
aired = f"{anime['attributes']['startDate']}{thing}" aired = f"{anime['attributes']['startDate']}{thing}"
template = f""" template = f"""
url: {url} url: {url}

View File

@ -5,10 +5,10 @@
'''Online File''' '''Online File'''
import asyncio
import traceback import traceback
from typing import Optional from typing import Optional
import asyncio
import discord import discord
from discord.ext.commands import Context from discord.ext.commands import Context