From 8cca2e80ecf66b9de1728deba905e72910da75a0 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 28 Oct 2021 09:33:34 +0000 Subject: [PATCH] Format code with black, yapf, autopep8 and isort This commit fixes the style issues introduced in a87a4a8 according to the output from black, yapf, autopep8 and isort. Details: https://deepsource.io/gh/The-4th-Hokage/yondaime-hokage/transform/6bf83a1c-fba0-4961-ab9c-3bb5f583a3fa/ --- .../bot_files/cogs/info/serverinfo.py | 3 +- .../bot_files/lib/classes/select_help.py | 70 +++++++++---------- .../bot_files/lib/functions/votes.py | 69 ++++++++++-------- 3 files changed, 75 insertions(+), 67 deletions(-) diff --git a/minato_namikaze/bot_files/cogs/info/serverinfo.py b/minato_namikaze/bot_files/cogs/info/serverinfo.py index 9089b9a9..8854f587 100644 --- a/minato_namikaze/bot_files/cogs/info/serverinfo.py +++ b/minato_namikaze/bot_files/cogs/info/serverinfo.py @@ -297,7 +297,8 @@ async def user(self, ctx, *, user: discord.Member = None): name="**__Member Info__**", value=("✏️ Name: {}\n" "{}: {}\n" - "📅 Created On: {}").format(user.display_name, user.display_name, + "📅 Created On: {}").format(user.display_name, + user.display_name, prev_names_val, created_on), ) diff --git a/minato_namikaze/bot_files/lib/classes/select_help.py b/minato_namikaze/bot_files/lib/classes/select_help.py index 36fe5a4e..5ebf93c3 100644 --- a/minato_namikaze/bot_files/lib/classes/select_help.py +++ b/minato_namikaze/bot_files/lib/classes/select_help.py @@ -99,20 +99,18 @@ async def callback(self, interaction: discord.Interaction): cog = self.bot.get_cog(value) if cog is None: await interaction.response.send_message( - "Somehow this category does not exist?", ephemeral=True - ) + "Somehow this category does not exist?", ephemeral=True) return commands = self.commands[cog] if not commands: await interaction.response.send_message( - "This category has no commands for you", ephemeral=True - ) + "This category has no commands for you", ephemeral=True) return - source = GroupHelpPageSource( - cog, commands, prefix=self.view.ctx.clean_prefix - ) + source = GroupHelpPageSource(cog, + commands, + prefix=self.view.ctx.clean_prefix) await self.view.rebind(source, interaction) @@ -132,17 +130,15 @@ async def get_page(self, page_number: int) -> Any: return self def format_page(self, menu: HelpMenu, page): - embed = discord.Embed( - title="Bot Help", colour=discord.Colour(0xA8B9CD)) - embed.description = inspect.cleandoc( - f""" + embed = discord.Embed(title="Bot Help", + colour=discord.Colour(0xA8B9CD)) + embed.description = inspect.cleandoc(f""" Hello! Welcome to the help page. Use "{menu.ctx.clean_prefix}help command" for more info on a command. Use "{menu.ctx.clean_prefix}help category" for more info on a category. Use the dropdown menu below to select a category. - """ - ) + """) embed.add_field( name="Support Server", @@ -154,12 +150,11 @@ def format_page(self, menu: HelpMenu, page): if self.index == 0: embed.add_field( name="Who are you?", - value=( - ":pray: Konichiwa :pray:, myself **Minato Namikaze**, **Konohagakure <:uzumaki_naruto:874930645405675521> Yondaime Hokage**" - f"I joined discord on {created_at}. I try my best to do every work of a **hokage**. You can get more " - "information on my commands by using the *dropdown* below.\n\n" - f"I'm also open source. You can see my code on [GitHub]({LinksAndVars.github.value})!" - ), + value=(":pray: Konichiwa :pray:, myself **Minato Namikaze**, **Konohagakure <:uzumaki_naruto:874930645405675521> Yondaime Hokage**" + f"I joined discord on {created_at}. I try my best to do every work of a **hokage**. You can get more " + "information on my commands by using the *dropdown* below.\n\n" + f"I'm also open source. You can see my code on [GitHub]({LinksAndVars.github.value})!" + ), inline=False, ) elif self.index == 1: @@ -191,15 +186,14 @@ def __init__(self, source: menus.PageSource, ctx: commands.Context): super().__init__(source, ctx=ctx, compact=True) def add_categories( - self, commands: Dict[commands.Cog, List[commands.Command]] - ) -> None: + self, commands: Dict[commands.Cog, + List[commands.Command]]) -> None: self.clear_items() self.add_item(HelpSelectMenu(commands, self.ctx.bot)) self.fill_items() - async def rebind( - self, source: menus.PageSource, interaction: discord.Interaction - ) -> None: + async def rebind(self, source: menus.PageSource, + interaction: discord.Interaction) -> None: self.source = source self.current_page = 0 @@ -214,12 +208,12 @@ class PaginatedHelpCommand(commands.HelpCommand): def __init__(self): super().__init__( command_attrs={ - "cooldown": commands.CooldownMapping.from_cooldown( - 1, 3.0, commands.BucketType.member - ), - "help": "Shows help about the bot, a command, or a category", - } - ) + "cooldown": + commands.CooldownMapping.from_cooldown( + 1, 3.0, commands.BucketType.member), + "help": + "Shows help about the bot, a command, or a category", + }) def get_command_signature(self, command): parent = command.full_parent_name @@ -241,8 +235,7 @@ def key(command) -> str: return cog.qualified_name if cog else "\U0010ffff" entries: List[commands.Command] = await self.filter_commands( - bot.commands, sort=True, key=key - ) + bot.commands, sort=True, key=key) all_commands: Dict[commands.Cog, List[commands.Command]] = {} for name, children in itertools.groupby(entries, key=key): @@ -250,8 +243,8 @@ def key(command) -> str: continue cog = bot.get_cog(name) - all_commands[cog] = sorted( - children, key=lambda c: c.qualified_name) + all_commands[cog] = sorted(children, + key=lambda c: c.qualified_name) menu = HelpMenu(FrontPageSource(), ctx=self.context) menu.add_categories(all_commands) @@ -260,8 +253,8 @@ def key(command) -> str: async def send_cog_help(self, cog): entries = await self.filter_commands(cog.get_commands(), sort=True) menu = HelpMenu( - GroupHelpPageSource( - cog, entries, prefix=self.context.clean_prefix), + GroupHelpPageSource(cog, entries, + prefix=self.context.clean_prefix), ctx=self.context, ) await menu.start() @@ -288,8 +281,9 @@ async def send_group_help(self, group): if len(entries) == 0: return await self.send_command_help(group) - source = GroupHelpPageSource( - group, entries, prefix=self.context.clean_prefix) + source = GroupHelpPageSource(group, + entries, + prefix=self.context.clean_prefix) self.common_command_formatting(source, group) menu = HelpMenu(source, ctx=self.context) await menu.start() diff --git a/minato_namikaze/bot_files/lib/functions/votes.py b/minato_namikaze/bot_files/lib/functions/votes.py index 3bcd6d7a..543e1127 100644 --- a/minato_namikaze/bot_files/lib/functions/votes.py +++ b/minato_namikaze/bot_files/lib/functions/votes.py @@ -5,9 +5,10 @@ def votedVoidBots(ctx): - if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in ( - 747480356625711204, - 853549974212837376, + if ctx.author.id in (ctx.bot.owner_id, + 837223478934896670) or ctx.guild.id in ( + 747480356625711204, + 853549974212837376, ): return True e1 = requests.get( @@ -24,9 +25,10 @@ def votedVoidBots(ctx): def votedTopgg(ctx): - if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in ( - 747480356625711204, - 853549974212837376, + if ctx.author.id in (ctx.bot.owner_id, + 837223478934896670) or ctx.guild.id in ( + 747480356625711204, + 853549974212837376, ): return True a = requests.get( @@ -44,14 +46,18 @@ def votedTopgg(ctx): def votedbotsfordiscord(ctx): - if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in ( - 747480356625711204, - 853549974212837376, + if ctx.author.id in (ctx.bot.owner_id, + 837223478934896670) or ctx.guild.id in ( + 747480356625711204, + 853549974212837376, ): return True c = requests.get( f"https://botsfordiscord.com/api/bot/{ctx.bot.user.id}/votes", - headers={"Authorization": bfd, "Content-Type": "application/json"}, + headers={ + "Authorization": bfd, + "Content-Type": "application/json" + }, ) try: c_list = str(ctx.message.author.id) in c.json().get("hasVoted24") @@ -63,9 +69,10 @@ def votedbotsfordiscord(ctx): def voteddiscordboats(ctx): - if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in ( - 747480356625711204, - 853549974212837376, + if ctx.author.id in (ctx.bot.owner_id, + 837223478934896670) or ctx.guild.id in ( + 747480356625711204, + 853549974212837376, ): return True d = requests.get( @@ -82,9 +89,10 @@ def voteddiscordboats(ctx): def votedfateslist(ctx): - if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in ( - 747480356625711204, - 853549974212837376, + if ctx.author.id in (ctx.bot.owner_id, + 837223478934896670) or ctx.guild.id in ( + 747480356625711204, + 853549974212837376, ): return True f = requests.get( @@ -102,9 +110,10 @@ def votedfateslist(ctx): def votedbladebotlist(ctx): - if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in ( - 747480356625711204, - 853549974212837376, + if ctx.author.id in (ctx.bot.owner_id, + 837223478934896670) or ctx.guild.id in ( + 747480356625711204, + 853549974212837376, ): return True g = requests.get( @@ -120,9 +129,10 @@ def votedbladebotlist(ctx): def voteddiscordlistspace(ctx): - if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in ( - 747480356625711204, - 853549974212837376, + if ctx.author.id in (ctx.bot.owner_id, + 837223478934896670) or ctx.guild.id in ( + 747480356625711204, + 853549974212837376, ): return True h = requests.get( @@ -141,8 +151,10 @@ def voteddiscordlistspace(ctx): def generatevoteembed(ctx, *argv): list_dict = { "top.gg": "https://top.gg/images/dblnew.png", - "discordlist.space": "https://discordlist.space/img/apple-touch-icon.png", - "botsfordiscord": "https://botsfordiscord.com/img/favicons/apple-touch-icon-57x57.png", + "discordlist.space": + "https://discordlist.space/img/apple-touch-icon.png", + "botsfordiscord": + "https://botsfordiscord.com/img/favicons/apple-touch-icon-57x57.png", "discord.boats": "https://discord.boats/apple-icon-57x57.png", "fateslist": "https://fateslist.xyz/static/botlisticon.webp", "bladebotlist": "https://bladebotlist.xyz/img/logo.png", @@ -150,7 +162,8 @@ def generatevoteembed(ctx, *argv): } site_dict = { "top.gg": f"https://top.gg/bot/{ctx.bot.user.id}", - "discordlist.space": f"https://discordlist.space/bot/{ctx.bot.user.id}", + "discordlist.space": + f"https://discordlist.space/bot/{ctx.bot.user.id}", "botsfordiscord": f"https://botsfordiscord.com/bot/{ctx.bot.user.id}", "discord.boats": f"https://discord.boats/bot/{ctx.bot.user.id}", "fateslist": f"https://fateslist.xyz/bot/{ctx.bot.user.id}", @@ -181,9 +194,9 @@ def generatevoteembed(ctx, *argv): description=f'You need to **vote for me** in the **following botlists** :smile: :\n・{join_string.join([f"**[{i.capitalize()}]({site_dict[i.lower()]})**" for i in argv[0]])}', timestamp=ctx.message.created_at, ) - e.set_author( - name=ctx.message.author, url=website, icon_url=ctx.message.author.avatar_url - ) + e.set_author(name=ctx.message.author, + url=website, + icon_url=ctx.message.author.avatar_url) e.set_thumbnail(url=ctx.message.author.avatar_url) e.set_footer( text=f"Vote for us in the above mentioned botlists and then enjoy the `{ctx.command.name}` command."