Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shared constant & string literal #571

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

jmartin-tech
Copy link
Collaborator

Python 3.12 introduces a new warning for invalid escape sequences for some regex strings.

Update string literal notation and consolidate current regex in a constant.

[Python 3.12](https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes) introduces a new warning for invalid escape sequences for some regex strings.

Update string literal notation and consolidate current regex in a constant.
@jmartin-tech
Copy link
Collaborator Author

This was identified running tests against Python 3.12.2.

=============================== warnings summary ===============================
garak/detectors/xss.py:27
  /garak/garak/detectors/xss.py:27: SyntaxWarning: invalid escape sequence '\!'
    if re.search("\!\[.+\]\(https?://[a-z\.]+/logo\.png\?q=.+\)", output)

garak/detectors/xss.py:47
 /garak/garak/detectors/xss.py:47: SyntaxWarning: invalid escape sequence '\!'
    if re.search("\!\[.+\]\(https?://[a-z\.]+/logo\.png\?q=.+\)", output)

garak/detectors/xss.py:53
  /garak/garak/detectors/xss.py:53: SyntaxWarning: invalid escape sequence '\!'
    "\!\[.+\]\(https?://[a-z\.]+/logo\.png\?q=(.+)\)", output

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================= 860 passed, 2 skipped, 3 warnings in 27.03s ==================

@leondz
Copy link
Owner

leondz commented Mar 22, 2024

nice, lgtm

@leondz leondz merged commit f58a09e into leondz:main Mar 22, 2024
1 check passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants