Skip to content

Commit

Permalink
Fixed ruff feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
JelmerKorten committed Feb 12, 2024
1 parent a03b682 commit 7bb7be4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bot/exts/fun/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def conversion_func(text: str) -> str:
converted_text = f">>> {converted_text.lstrip('> ')}"
await ctx.send(content=converted_text, embed=embed)

@commands.command(name="screamingsnakecase", aliases=("screamsnake", "ssnake","screamingsnake",))
@commands.command(name="screamingsnakecase", aliases=("screamsnake", "ssnake", "screamingsnake",))
async def screamingsnakecase_command(self, ctx: Context, *, text: str | None) -> None:
"""Attempts to convert the provided string to SCREAMING_SNAKE_CASE."""
text = helpers.neutralise_string(text)
Expand Down
6 changes: 3 additions & 3 deletions bot/utils/helpers.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# imports
import re


def suppress_links(message: str) -> str:
"""Accepts a message that may contain links, suppresses them, and returns them."""
for link in set(re.findall(r"https?://[^\s]+", message, re.IGNORECASE)):
message = message.replace(link, f"<{link}>")
return message

def neutralise_string(txt: str) -> str:
"""Attempts to neutralise all punctuation and cases and returns a string of lowercase words"""
"""Attempts to neutralise all punctuation and cases and returns a string of lowercase words."""
# take out punctuation
txt = re.sub(r'([^\w\s]|_)',' ',txt)
txt = re.sub(r"([^\w\s]|_)", " ", txt)

# full caps words but leaves CamelCase / pascalCase
words = [word.lower() if word.isupper() else word for word in txt.split()]
Expand Down

0 comments on commit 7bb7be4

Please sign in to comment.