Make blacklist and whitelist cleaner

This commit is contained in:
Joakim Hellsén 2023-01-10 17:29:00 +01:00
commit 25c95366ad
No known key found for this signature in database
GPG key ID: C889E6DC5EDBB36D
2 changed files with 2 additions and 4 deletions

View file

@ -19,8 +19,7 @@ def is_word_in_text(words: str, text: str) -> bool:
for word in word_list:
look_for: str = rf"(^|[^\w]){word}([^\w]|$)"
pattern: re.Pattern[str] = re.compile(look_for, re.IGNORECASE)
matches: re.Match[str] | None = re.search(pattern, text)
if matches:
if re.search(pattern, text):
return True
return False

View file

@ -19,8 +19,7 @@ def is_word_in_text(words: str, text: str) -> bool:
for word in word_list:
look_for: str = rf"(^|[^\w]){word}([^\w]|$)"
pattern: re.Pattern[str] = re.compile(look_for, re.IGNORECASE)
matches: re.Match[str] | None = re.search(pattern, text)
if matches:
if re.search(pattern, text):
return True
return False