python-sonic-client icon indicating copy to clipboard operation
python-sonic-client copied to clipboard

Fix SyntaxWarning: invalid escape sequence errors on Python 3.12

Open pirate opened this issue 1 year ago • 0 comments

When using this library with Python 3.12, several warnings are displayed:

./.venv/lib/python3.12/site-packages/sonic/client.py:115: SyntaxWarning: invalid escape sequence '\('
  matches = re.findall("protocol\((\w+)\)", text)
./.venv/lib/python3.12/site-packages/sonic/client.py:134: SyntaxWarning: invalid escape sequence '\('
  matches = re.findall("buffer\((\w+)\)", text)
./.venv/lib/python3.12/site-packages/sonic/client.py:153: SyntaxWarning: invalid escape sequence '\w'
  matches = re.findall("PENDING (\w+)", text)

This PR fixes the issue by making marking these strings as r'...' "raw" strings.

pirate avatar Oct 04 '24 10:10 pirate