From 25c95366adc3b08f5f7bae2c6690e17a56f35af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Tue, 10 Jan 2023 17:29:00 +0100 Subject: [PATCH] Make blacklist and whitelist cleaner --- discord_rss_bot/blacklist.py | 3 +-- discord_rss_bot/whitelist.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/discord_rss_bot/blacklist.py b/discord_rss_bot/blacklist.py index e4bfa13..0f1aad5 100644 --- a/discord_rss_bot/blacklist.py +++ b/discord_rss_bot/blacklist.py @@ -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 diff --git a/discord_rss_bot/whitelist.py b/discord_rss_bot/whitelist.py index 7024053..f4153d9 100644 --- a/discord_rss_bot/whitelist.py +++ b/discord_rss_bot/whitelist.py @@ -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