From aa86e211e55452315d35d7b435b4a452ea0837ff Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:53:51 +0000 Subject: [PATCH] style: format code with black Format code with black This commit fixes the style issues introduced in 4e68539 according to the output from Black. Details: None --- lynxie/commands/animals.py | 4 +-- lynxie/commands/image.py | 60 +++++++++++++++++++++++--------------- lynxie/config.py | 4 +-- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/lynxie/commands/animals.py b/lynxie/commands/animals.py index 4b1b74b..5bd121a 100644 --- a/lynxie/commands/animals.py +++ b/lynxie/commands/animals.py @@ -34,8 +34,6 @@ class Animals(commands.Cog): embed = discord.Embed( title=animal.capitalize(), colour=discord.Colour.orange(), - ).set_image( - url="attachment://image.png" - ) + ).set_image(url="attachment://image.png") await ctx.reply(embed=embed, file=animal_file, mention_author=False) diff --git a/lynxie/commands/image.py b/lynxie/commands/image.py index 41310f8..c522609 100644 --- a/lynxie/commands/image.py +++ b/lynxie/commands/image.py @@ -16,7 +16,9 @@ class Img(commands.Cog): def __init__(self, bot): self.bot = bot self._overlays = { - "bubble": Image.open(os.path.join(ASSETS_PATH, "bubble.png")).convert("RGBA"), + "bubble": Image.open(os.path.join(ASSETS_PATH, "bubble.png")).convert( + "RGBA" + ), "gang": Image.open(os.path.join(ASSETS_PATH, "gang.png")).convert("RGBA"), } @@ -29,8 +31,10 @@ class Img(commands.Cog): # Check if image should be processed async with ctx.typing(): if not style or style not in IMAGE_OVERLAYS: - error = "That is not a valid option! Valid options are:\n" \ - f"`{', '.join(IMAGE_OVERLAYS)}`" + error = ( + "That is not a valid option! Valid options are:\n" + f"`{', '.join(IMAGE_OVERLAYS)}`" + ) await ctx.reply(embed=error_message(error)) return @@ -40,20 +44,27 @@ class Img(commands.Cog): return # Extracts file extension from filename - if not ctx.message.attachments[0].filename.split(".")[-1].lower() in IMAGE_EXTENSIONS: - error = "Unsupported file type! Supported file types are:\n" \ - f"`{', '.join(IMAGE_EXTENSIONS)}`" + if ( + not ctx.message.attachments[0].filename.split(".")[-1].lower() + in IMAGE_EXTENSIONS + ): + error = ( + "Unsupported file type! Supported file types are:\n" + f"`{', '.join(IMAGE_EXTENSIONS)}`" + ) await ctx.reply(embed=error_message(error)) return if ctx.message.attachments[0].size > 8_000_000: - error = "That image is too big! Please use an image that is less than 8MB." + error = ( + "That image is too big! Please use an image that is less than 8MB." + ) await ctx.reply(embed=error_message(error)) return if ( - not 0 < ctx.message.attachments[0].width <= 3500 or - not 0 < ctx.message.attachments[0].height <= 3500 + not 0 < ctx.message.attachments[0].width <= 3500 + or not 0 < ctx.message.attachments[0].height <= 3500 ): error = "Image must be at least 1x1 and under 3500x3500!" await ctx.reply(embed=error_message(error)) @@ -73,27 +84,24 @@ class Img(commands.Cog): # The bubble is resized twice as for some reason .copy() doesn't work message_attachment.paste( self._overlays["bubble"].resize( - ( - message_attachment.width, - self._overlays["bubble"].height - ) + (message_attachment.width, self._overlays["bubble"].height) ), (0, 0), self._overlays["bubble"].resize( - ( - message_attachment.width, - self._overlays["bubble"].height - ) + (message_attachment.width, self._overlays["bubble"].height) ), ) elif style == "gang": message_attachment.paste( self._overlays["gang"], ( - ((message_attachment.width - self._overlays["gang"].width) // 2), - (message_attachment.height - self._overlays["gang"].height) + ( + (message_attachment.width - self._overlays["gang"].width) + // 2 + ), + (message_attachment.height - self._overlays["gang"].height), ), - self._overlays["gang"] + self._overlays["gang"], ) message_file = BytesIO() @@ -102,9 +110,13 @@ class Img(commands.Cog): message_file = discord.File(message_file, filename="image.png") time_taken = datetime.datetime.now() - start_time - embed = discord.Embed(title=style.capitalize(), colour=discord.Colour.orange())\ - .set_image(url="attachment://image.png")\ - .set_footer(text=f"{message_attachment.width}x{message_attachment.height}, " - f"{time_taken.microseconds / 1000}ms") + embed = ( + discord.Embed(title=style.capitalize(), colour=discord.Colour.orange()) + .set_image(url="attachment://image.png") + .set_footer( + text=f"{message_attachment.width}x{message_attachment.height}, " + f"{time_taken.microseconds / 1000}ms" + ) + ) await ctx.reply(embed=embed, file=message_file, mention_author=False) diff --git a/lynxie/config.py b/lynxie/config.py index 713b32e..e4b9817 100644 --- a/lynxie/config.py +++ b/lynxie/config.py @@ -47,9 +47,7 @@ TINYFOX_ANIMALS = [ "woof", ] -IMAGE_EXTENSIONS = [ - "png", "jpg", "jpeg", "webp" -] +IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp"] IMAGE_OVERLAYS = [ "bubble",