From 0c521ee0bab9cdb3450909244a0cb2e839959358 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 17 Oct 2021 17:52:53 +0000 Subject: [PATCH] Change methods not using its bound instance to staticmethods --- minato_namikaze/bot_files/cogs/fun/encoding.py | 6 ++++-- minato_namikaze/bot_files/cogs/info/mysupport.py | 3 ++- minato_namikaze/bot_files/cogs/info/snipe.py | 3 ++- minato_namikaze/bot_files/cogs/music.py | 3 ++- minato_namikaze/bot_files/lib/classes/games/typeracer.py | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/minato_namikaze/bot_files/cogs/fun/encoding.py b/minato_namikaze/bot_files/cogs/fun/encoding.py index ed6f64dd..8da8133c 100644 --- a/minato_namikaze/bot_files/cogs/fun/encoding.py +++ b/minato_namikaze/bot_files/cogs/fun/encoding.py @@ -72,7 +72,8 @@ def __init__(self, bot): def display_emoji(self) -> discord.PartialEmoji: return discord.PartialEmoji(name="\N{NUMBER SIGN}\U000020e3") - def search_words(self, data: str) -> bool: + @staticmethod + def search_words(data: str) -> bool: count = 0 try: for char in data: @@ -304,7 +305,8 @@ async def decode_braille(self, ctx: commands.Context, *, message: str) -> None: await ctx.send(message[:2000]) - def rot_encode(self, n: int, text: str) -> str: + @staticmethod + def rot_encode(n: int, text: str) -> str: """ https://stackoverflow.com/questions/47580337/short-rot-n-decode-function-in-python """ diff --git a/minato_namikaze/bot_files/cogs/info/mysupport.py b/minato_namikaze/bot_files/cogs/info/mysupport.py index a8c385a3..67820e22 100644 --- a/minato_namikaze/bot_files/cogs/info/mysupport.py +++ b/minato_namikaze/bot_files/cogs/info/mysupport.py @@ -21,7 +21,8 @@ def __init__(self, bot): def display_emoji(self) -> discord.PartialEmoji: return discord.PartialEmoji(name="\N{SQUARED SOS}") - def format_commit(self, commit): + @staticmethod + def format_commit(commit): short, _, _ = commit.message.partition("\n") short_sha2 = commit.hex[0:6] commit_tz = datetime.timezone( diff --git a/minato_namikaze/bot_files/cogs/info/snipe.py b/minato_namikaze/bot_files/cogs/info/snipe.py index 3c66d046..db1957c5 100644 --- a/minato_namikaze/bot_files/cogs/info/snipe.py +++ b/minato_namikaze/bot_files/cogs/info/snipe.py @@ -32,7 +32,8 @@ async def on_message_edit(before, after): def display_emoji(self) -> discord.PartialEmoji: return discord.PartialEmoji(name="\N{DIRECT HIT}") - def sanitise(self, string): + @staticmethod + def sanitise(string): if len(string) > 1024: string = string[0:1021] + "..." string = re.sub(invitere2, "[INVITE REDACTED]", string) diff --git a/minato_namikaze/bot_files/cogs/music.py b/minato_namikaze/bot_files/cogs/music.py index fbf459fe..453ac944 100644 --- a/minato_namikaze/bot_files/cogs/music.py +++ b/minato_namikaze/bot_files/cogs/music.py @@ -73,7 +73,8 @@ async def cog_check(self, ctx: commands.Context): return True - def songembed(self, song): + @staticmethod + def songembed(song): e = Embed() e.set_thumbnail(url=song.thumbnail) e.set_image(url=song.thumbnail) diff --git a/minato_namikaze/bot_files/lib/classes/games/typeracer.py b/minato_namikaze/bot_files/lib/classes/games/typeracer.py index 194f71cd..5f77b79c 100644 --- a/minato_namikaze/bot_files/lib/classes/games/typeracer.py +++ b/minato_namikaze/bot_files/lib/classes/games/typeracer.py @@ -51,7 +51,8 @@ class TypeRacer: 'night', 'real', 'life', 'few', 'north' ) - def _tr_img(self, text: str, font: str): + @staticmethod + def _tr_img(text: str, font: str): text = "\n".join(textwrap.wrap(text, width=25)) height = ceil(len(text) / 25) * 70 image = Image.new("RGBA", (640, height), 0)