From 6441fd0027a15f0ba3f562ca09243e9a706fefc0 Mon Sep 17 00:00:00 2001 From: "J. Hunter Johnson" Date: Wed, 3 Jun 2026 11:21:02 -0400 Subject: [PATCH 1/2] Fix Python 3.12+ invalid escape sequence warnings in search_haystack --- apps/gcd/views/search_haystack.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/gcd/views/search_haystack.py b/apps/gcd/views/search_haystack.py index fc7274ae..65c8bc76 100644 --- a/apps/gcd/views/search_haystack.py +++ b/apps/gcd/views/search_haystack.py @@ -39,12 +39,12 @@ class GcdNameQuery(AutoQuery): def prepare(self, query_obj): query_string = super(GcdNameQuery, self).prepare(query_obj) query_return = '' - query_string = query_string.replace('[', '\[')\ - .replace(']', '\]')\ - .replace('{', '\{')\ - .replace('}', '\}')\ - .replace(':', '\:')\ - .replace('!', '\!')\ + query_string = query_string.replace('[', r'\[')\ + .replace(']', r'\]')\ + .replace('{', r'\{')\ + .replace('}', r'\}')\ + .replace(':', r'\:')\ + .replace('!', r'\!')\ .replace('/', ' ') if ((query_string[0] == '"' and query_string[-1] == '"') or (query_string[0] == "'" and query_string[-1] == "'")): @@ -60,8 +60,8 @@ def prepare(self, query_obj): class GcdAutoQuery(AutoQuery): def prepare(self, query_obj): query_string = super(GcdAutoQuery, self).prepare(query_obj) - if '\*' in query_string and len(query_string) > 2: - query_string = query_string.replace('\*', '*') + if r'\*' in query_string and len(query_string) > 2: + query_string = query_string.replace(r'\*', '*') if ' ' in query_string: query_string = '"' + query_string + '"' return query_string From 02688bf9022fdc0706bf2f0f131409a6e4b7ad9a Mon Sep 17 00:00:00 2001 From: "J. Hunter Johnson" Date: Wed, 3 Jun 2026 12:52:58 -0400 Subject: [PATCH 2/2] Refactor line continuations to use parentheses per PEP 8 --- apps/gcd/views/search_haystack.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/gcd/views/search_haystack.py b/apps/gcd/views/search_haystack.py index 65c8bc76..f83b66ef 100644 --- a/apps/gcd/views/search_haystack.py +++ b/apps/gcd/views/search_haystack.py @@ -39,13 +39,15 @@ class GcdNameQuery(AutoQuery): def prepare(self, query_obj): query_string = super(GcdNameQuery, self).prepare(query_obj) query_return = '' - query_string = query_string.replace('[', r'\[')\ - .replace(']', r'\]')\ - .replace('{', r'\{')\ - .replace('}', r'\}')\ - .replace(':', r'\:')\ - .replace('!', r'\!')\ - .replace('/', ' ') + query_string = ( + query_string.replace('[', r'\[') + .replace(']', r'\]') + .replace('{', r'\{') + .replace('}', r'\}') + .replace(':', r'\:') + .replace('!', r'\!') + .replace('/', ' ') + ) if ((query_string[0] == '"' and query_string[-1] == '"') or (query_string[0] == "'" and query_string[-1] == "'")): query_return = query_string