Skip to content

corrected escape sequence#79

Open
aryan0931 wants to merge 1 commit intosugarlabs:masterfrom
aryan0931:master
Open

corrected escape sequence#79
aryan0931 wants to merge 1 commit intosugarlabs:masterfrom
aryan0931:master

Conversation

@aryan0931
Copy link

Fixes: #78

Description

This PR updates two regular expression strings in Calculate.activity/astparser.py to use Python raw string notation (r'').
This prevents unintended escape sequence issues and resolves warnings raised by the Python interpreter when running the script.

Why this change?

Using raw strings in regular expressions ensures that backslashes (\) are treated literally, avoiding misinterpretation as Python escape sequences.
This is especially important for patterns like \. (literal dot) or \d, etc.

Testing

  • Ran the script with Python warnings enabled:
    python3 -Wall astparser.py
    

Signed-off-by: Aryan Yadav <141573833+aryan0931@users.noreply.github.com>
@pikurasa pikurasa requested review from chimosky and walterbender May 18, 2025 10:31
@quozl
Copy link

quozl commented Dec 19, 2025

Huh? Why would we not simply quote the backslashes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SyntaxWarning: invalid escape sequence

2 participants