ettoreleandrotognoli / python-ami

Python AMI Client
BSD 3-Clause "New" or "Revised" License
107 stars 66 forks source link

Fix Python 3.12 syntax warning #59

Closed fluxxcode closed 9 months ago

fluxxcode commented 9 months ago

On Python version 3.12.1, Python issues the following deprecation warnings:

python3.12/site-packages/asterisk/ami/client.py:52: SyntaxWarning: invalid escape sequence '\.'
  asterisk_start_regex = re.compile('^Asterisk *Call *Manager/(?P<version>([0-9]+\.)*[0-9]+)', re.IGNORECASE)
python3.12/site-packages/asterisk/ami/response.py:7: SyntaxWarning: invalid escape sequence '\-'
  key_regex = re.compile('^[a-zA-Z0-9_\-]+$')

According to the website https://adamj.eu/tech/2022/11/04/why-does-python-deprecationwarning-invalid-escape-sequence/ this is a warning that future Python versions may change to a syntax error.

I fixed the warnings by changing the affected strings to a raw string.

ettoreleandrotognoli commented 9 months ago

thanks ^^