Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change methods not using its bound instance to staticmethods #220

Merged
merged 1 commit into from
Oct 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions minato_namikaze/bot_files/cogs/fun/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
"""
Expand Down
3 changes: 2 additions & 1 deletion minato_namikaze/bot_files/cogs/info/mysupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion minato_namikaze/bot_files/cogs/info/snipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion minato_namikaze/bot_files/cogs/music.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion minato_namikaze/bot_files/lib/classes/games/typeracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down