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

Regex SyntaxWarning #27

Open
Yelinz opened this issue Jun 7, 2024 · 0 comments
Open

Regex SyntaxWarning #27

Yelinz opened this issue Jun 7, 2024 · 0 comments

Comments

@Yelinz
Copy link

Yelinz commented Jun 7, 2024

Using python 3.12 a regex DeprecationWarning got upgraded to SyntaxWarning.

.../lib/python3.12/site-packages/xltpl/utils.py:23: SyntaxWarning: invalid escape sequence '\d'
  COORD = '[a-z]{1,3}\d+'
.../lib/python3.12/site-packages/xltpl/utils.py:24: SyntaxWarning: invalid escape sequence '\S'
  RANGETAG = '%s *%s *(%s:%s\S*?) *%s' % (RANGE, VARIABLE_START_STRING, COORD, COORD, VARIABLE_END_STRING)
.../lib/python3.12/site-packages/xltpl/utils.py:111: SyntaxWarning: invalid escape sequence '\d'
  FIXTEST = '({(?:___\d+___)?(?:{|%).+?(?:}|%)(?:___\d+___)?})'
.../lib/python3.12/site-packages/xltpl/utils.py:112: SyntaxWarning: invalid escape sequence '\d'
  RUNSPLIT = '(___\d+___)'
.../lib/python3.12/site-packages/xltpl/utils.py:113: SyntaxWarning: invalid escape sequence '\d'
  RUNSPLIT2 = '___(\d+)___'
.../lib/python3.12/site-packages/xltpl/jinja.py:25: SyntaxWarning: invalid escape sequence '\d'
  p = re.compile("'(\d*,\d*[,\d]*)'")

A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning.

from https://docs.python.org/3/whatsnew/3.12.html#other-language-changes

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

No branches or pull requests

1 participant