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

Address a couple of Python SyntaxWarnings. #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emollier
Copy link

@emollier emollier commented Dec 3, 2024

Running uncalled with Python 3.13 raises a couple of syntax warning, reproducible for instance by running the example script:

$ cd example
$ ./run_example.sh
/usr/bin/uncalled:307: SyntaxWarning: invalid escape sequence '\-'
  log_re = re.compile("^([0-9\-]+ [0-9:]+).+ :.+instance_started.+")
/usr/bin/uncalled:308: SyntaxWarning: invalid escape sequence '\d'
  port_re = re.compile("grpc_port = (\d+)")
/usr/bin/uncalled:309: SyntaxWarning: invalid escape sequence '\s'
  device_re = re.compile("(device_id|instance) = ([^\s,]+)")
[…]

In addition, Debian bug #1087156 reported also another instance of the issue in the debug.py script:

Setting up uncalled (2.3+ds-2) ...
/usr/lib/python3/dist-packages/uncalled/debug.py:23: SyntaxWarning: invalid escape sequence '\d'
  CIG_RE = re.compile("(\d+)(["+CIG_OPS_STR+"])")

This change adjusts strings to become raw strings, in order to spare Python further attempts to interpret backslashed characters as escape sequences that are invalid.

Running uncalled with Python 3.13 raises a couple of syntax warning,
reproducible for instance by running the example script:

	$ cd example
	$ ./run_example.sh
	/usr/bin/uncalled:307: SyntaxWarning: invalid escape sequence '\-'
	  log_re = re.compile("^([0-9\-]+ [0-9:]+).+ :.+instance_started.+")
	/usr/bin/uncalled:308: SyntaxWarning: invalid escape sequence '\d'
	  port_re = re.compile("grpc_port = (\d+)")
	/usr/bin/uncalled:309: SyntaxWarning: invalid escape sequence '\s'
	  device_re = re.compile("(device_id|instance) = ([^\s,]+)")
	[…]

In addition, [Debian bug #1087156] reported also another instance of
the issue in the debug.py script:

	Setting up uncalled (2.3+ds-2) ...
	/usr/lib/python3/dist-packages/uncalled/debug.py:23: SyntaxWarning: invalid escape sequence '\d'
	  CIG_RE = re.compile("(\d+)(["+CIG_OPS_STR+"])")

This change adjusts strings to become raw strings, in order to spare
Python further attempts to interpret backslashed characters as escape
sequences that are invalid.

[Debian bug #1087156]: https://bugs.debian.org/1087156

Signed-off-by: Étienne Mollier <[email protected]>
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.

1 participant