[GrandComicsDatabase/gcd-django] Fix Python 3.12+ invalid escape sequence warnings in search_haystack (PR #714)

10 views
Skip to first unread message

jhunterjActual

unread,
Jun 3, 2026, 11:34:17 AM (5 days ago) Jun 3
to GrandComicsDatabase/gcd-django, Subscribed

converted the escape search strings to raw strings to clean up the startup logs for modern Python environments


You can view, comment on, or merge this pull request online at:

  https://github.com/GrandComicsDatabase/gcd-django/pull/714

Commit Summary

  • 6441fd0 Fix Python 3.12+ invalid escape sequence warnings in search_haystack

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <GrandComicsDatabase/gcd-django/pull/714@github.com>

gemini-code-assist[bot]

unread,
Jun 3, 2026, 11:35:22 AM (5 days ago) Jun 3
to GrandComicsDatabase/gcd-django, Subscribed

@gemini-code-assist[bot] commented on this pull request.

Code Review

This pull request updates string literals containing backslashes to raw string literals in apps/gcd/views/search_haystack.py to avoid escape sequence issues. The review feedback suggests refactoring the multi-line string replacement chain to use implicit line continuation inside parentheses instead of backslashes, adhering to PEP 8 guidelines.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


In apps/gcd/views/search_haystack.py:

> +        query_string = query_string.replace('[', r'\[')\
+                                   .replace(']', r'\]')\
+                                   .replace('{', r'\{')\
+                                   .replace('}', r'\}')\
+                                   .replace(':', r'\:')\
+                                   .replace('!', r'\!')\
                                    .replace('/', ' ')

medium

Using backslash (\\) for line continuation is discouraged in PEP 8 because it is fragile and can easily lead to syntax errors if accidental whitespace is introduced after the backslash. Instead, wrap the expression in parentheses to leverage Python's implicit line continuation, which is cleaner and safer.

        query_string = (
            query_string.replace('[', r'\[')
            .replace(']', r'\]')
            .replace('{', r'\{')
            .replace('}', r'\}')
            .replace(':', r'\:')
            .replace('!', r'\!')
            .replace('/', ' ')
        )
References
  1. PEP 8 prefers using Python's implied line continuation inside parentheses, brackets, and braces over backslash line continuation. (link)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <GrandComicsDatabase/gcd-django/pull/714/review/4420138662@github.com>

jhunterjActual

unread,
Jun 3, 2026, 1:05:59 PM (5 days ago) Jun 3
to GrandComicsDatabase/gcd-django, Push

@jhunterjActual pushed 1 commit.

  • 02688bf Refactor line continuations to use parentheses per PEP 8


View it on GitHub or unsubscribe.


Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <GrandComicsDatabase/gcd-django/pull/714/before/6441fd0027a15f0ba3f562ca09243e9a706fefc0/after/02688bf9022fdc0706bf2f0f131409a6e4b7ad9a@github.com>

jhunterjActual

unread,
Jun 3, 2026, 1:06:22 PM (5 days ago) Jun 3
to GrandComicsDatabase/gcd-django, Subscribed

@jhunterjActual commented on this pull request.


In apps/gcd/views/search_haystack.py:

> +        query_string = query_string.replace('[', r'\[')\
+                                   .replace(']', r'\]')\
+                                   .replace('{', r'\{')\
+                                   .replace('}', r'\}')\
+                                   .replace(':', r'\:')\
+                                   .replace('!', r'\!')\
                                    .replace('/', ' ')

Incorporated.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <GrandComicsDatabase/gcd-django/pull/714/review/4420891566@github.com>

David Nixon

unread,
Jun 5, 2026, 9:52:33 AM (3 days ago) Jun 5
to GrandComicsDatabase/gcd-django, Subscribed
davidnixon left a comment (GrandComicsDatabase/gcd-django#714)

LGTM.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <GrandComicsDatabase/gcd-django/pull/714/c4632260081@github.com>

Reply all
Reply to author
Forward
0 new messages