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

Fix regex pattern with raw string literals #282

Merged
merged 2 commits into from
Nov 19, 2024
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
2 changes: 1 addition & 1 deletion bgstally/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@ def string_to_alphanumeric(s: str) -> str:
Returns:
str: The cleaned string
"""
pattern: re.Pattern = re.compile('[\W_]+')
pattern: re.Pattern = re.compile(r'[\W_]+')
return pattern.sub('', s)
4 changes: 2 additions & 2 deletions bgstally/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class to convert text with a limited set of Discord-supported ansi color codes t

# define some regexes which will come in handy in filtering
# out the ansi color codes
color_pat = re.compile("\x01?\x1b(\[[\d;]*m?)\x02?")
inner_color_pat = re.compile("^\[([\d;]*)m$")
color_pat = re.compile(r'\x01?\x1b(\[[\d;]*m?)\x02?')
inner_color_pat = re.compile(r'^\[([\d;]*)m$')

def __init__(self, *args, **kwargs):
"""
Expand Down
Loading