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 SyntaxWarnings #185

Open
trenslow opened this issue Sep 24, 2024 · 0 comments
Open

Regex SyntaxWarnings #185

trenslow opened this issue Sep 24, 2024 · 0 comments

Comments

@trenslow
Copy link
Contributor

In Python 3.12 we're now getting SyntaxWarnings at runtime, i.e.:

/opt/venv/lib/python3.12/site-packages/panphon/segment.py:12: SyntaxWarning: invalid escape sequence '\w'
   """Constructs a `Segment` object that models a phonological segment as a vector of features.
/opt/venv/lib/python3.12/site-packages/epitran/cedict.py:25: SyntaxWarning: invalid escape sequence '\s'
   comment_re = re.compile('\s*#')
/opt/venv/lib/python3.12/site-packages/epitran/cedict.py:26: SyntaxWarning: invalid escape sequence '\['
   lemma_re = re.compile('(?P<hanzi>[^]]+) \[(?P<pinyin>[^]]+)\] /(?P<english>.+)/')
/opt/venv/lib/python3.12/site-packages/epitran/rules.py:44: SyntaxWarning: invalid escape sequence '\s'
   if not re.match('\s*%', line):

This was elevated from a DeprecationWarning in previous versions of Python, and they plan to make this a hard error in future versions.

I believe it's an easy fix by simply making the strings a raw string. I would be willing to submit a PR, but the versions between PyPI and GitHub don't line up, so I'm not sure where to branch off. The first line even is a warning from Panphon, so I could also make a fix there too.

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