8000 Use raw strings for regex patterns by Harmon758 · Pull Request #5 · paulovn/python-aiml · GitHub
[go: up one dir, main page]

Skip to content

Use raw strings for regex patterns #5

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

Merged
merged 1 commit into from
Jul 26, 2019

Conversation

Harmon758
Copy link
Python 3.8.0b2 (tags/v3.8.0b2:21dd01d, Jul  4 2019, 16:00:09) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import aiml
C:\Program Files\Python38\lib\site-packages\aiml\Kernel.py:1002: SyntaxWarning: invalid escape sequence \s
  elem[2] = re.sub("\s+", " ", elem[2])
C:\Program Files\Python38\lib\site-packages\aiml\PatternMgr.py:30: SyntaxWarning: invalid escape sequence \|
  punctuation = "\"`~!@#$%^&*()-_=+[{]}\|;:',<.>/?"
C:\Program Files\Python38\lib\site-packages\aiml\PatternMgr.py:32: SyntaxWarning: invalid escape sequence \s
  self._whitespaceRE = re.compile("\s+", re.UNICODE)

A backslash-character pair that is not a valid escape sequence generates a DeprecationWarning since Python 3.6. In Python 3.8 it generates a SyntaxWarning instead.

https://docs.python.org/3.8/whatsnew/3.8.html

Changed in version 3.6: Unrecognized escape sequences produce a DeprecationWarning.

Changed in version 3.8: Unrecognized escape sequences produce a SyntaxWarning. In some future version of Python they will be a SyntaxError.

https://docs.python.org/3.8/reference/lexical_analysis.html

https://bugs.python.org/issue32912, python/cpython#9652, python/cpython@6543912

@paulovn paulovn merged commit 2206a40 into paulovn:master Jul 26, 2019
@paulovn
Copy link
Owner
paulovn commented Jul 26, 2019

Thanks for this -- this is a leftover from the original 2.7 code

@Harmon758 Harmon758 deleted the regex-raw-string-usage branch July 27, 2019 17:11
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.

2 participants
0