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

Suspicious escape sequences in some regular expressions #49

Open
wjsuijlenh opened this issue Aug 2, 2024 · 1 comment
Open

Suspicious escape sequences in some regular expressions #49

wjsuijlenh opened this issue Aug 2, 2024 · 1 comment

Comments

@wjsuijlenh
Copy link

After removing any *.pyc file from the repository so that Python is forced to parse everything again, Python 3.12.4 displays some warnings about suspicious use of escape sequences in some of the regular expressions.
This is on commit 67ff862

I guess the original intention was to use Python's raw string notation?

[...]/pycsp3/classes/entities.py:313: SyntaxWarning: invalid escape sequence '\]'
  indexes = [int(v) if len(v) > 0 else None for v in re.split("\]\[", suffix[1:-1])]
[...]/pycsp3/classes/main/variables.py:199: SyntaxWarning: invalid escape sequence '\]'
  self.indexes = [int(v) for v in re.split("\]\[", self.suffix[1:-1])]
[...]/gitrepo/pycsp3/tools/aggregator.py:156: SyntaxWarning: invalid escape sequence '\d'
  if par not in re.findall('(%\d+)', abstract_tree):
[...]/gitrepo/pycsp3/tools/aggregator.py:157: SyntaxWarning: invalid escape sequence '\d'
  t = {int(m[1:]) for m in re.findall('(%\d+)', abstract_tree) if int(m[1:]) > i}
[...]/pycsp3/tools/compactor.py:17: SyntaxWarning: invalid escape sequence '\]'
  self.starts = [int(v) for v in re.split("\]\[", self.suffix[1:-1])]  # the indexes of the first variable (in case of an array)
[...]/pycsp3/tools/compactor.py:187: SyntaxWarning: invalid escape sequence '\]'
  tokens = [int(v) if v.isdigit() else v for v in re.split("\]\[", suffix[1:-1])]
[...]/pycsp3/tools/compactor.py:222: SyntaxWarning: invalid escape sequence '\]'
  part = sorted(part, key=lambda x: [int(v) for v in re.split("\]\[", x.id[x.id.index("[") + 1:-1])])
@wjsuijlenh wjsuijlenh changed the title Syntax warnings from Python 3.12.4 interpreter Suspicious escape sequences in some regular expressions Aug 2, 2024
@xcsp3team
Copy link
Owner

Thanks for the issue.
Expressions have been updated (and pushed)

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

2 participants