From 78ab23251663f0fc857765ac6137a4580eca83c6 Mon Sep 17 00:00:00 2001 From: Nate Hamm Date: Mon, 30 Dec 2024 15:31:02 -0600 Subject: [PATCH] fix: SyntaxWarning for Escape Characters in String Literals (#4792) --- mealie/repos/repository_cookbooks.py | 2 +- mealie/schema/response/query_search.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mealie/repos/repository_cookbooks.py b/mealie/repos/repository_cookbooks.py index 5d970c3249f..d453c3f70dc 100644 --- a/mealie/repos/repository_cookbooks.py +++ b/mealie/repos/repository_cookbooks.py @@ -36,7 +36,7 @@ def update(self, match_value: str | int | UUID4, data: SaveCookBook | dict) -> R data = SaveCookBook(**data) new_slug = slugify(data.name) - if not (data.slug and re.match(f"^({new_slug})(-\d+)?$", data.slug)): + if not (data.slug and re.match(rf"^({new_slug})(-\d+)?$", data.slug)): data.slug = new_slug max_retries = 10 diff --git a/mealie/schema/response/query_search.py b/mealie/schema/response/query_search.py index 21c390b3971..65d40310ff5 100644 --- a/mealie/schema/response/query_search.py +++ b/mealie/schema/response/query_search.py @@ -16,7 +16,7 @@ class SearchFilter: 3. remove special characters from each non-literal search string """ - punctuation = "!\#$%&()*+,-./:;<=>?@[\\]^_`{|}~" # string.punctuation with ' & " removed + punctuation = r"!\#$%&()*+,-./:;<=>?@[\\]^_`{|}~" # string.punctuation with ' & " removed quoted_regex = re.compile(r"""(["'])(?:(?=(\\?))\2.)*?\1""") remove_quotes_regex = re.compile(r"""['"](.*)['"]""")