wordnik / wordnik-python3

wordnik python3 library
74 stars 13 forks source link

Invalid escape sequence warnings #5

Open Harmon758 opened 5 years ago

Harmon758 commented 5 years ago

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

https://docs.python.org/3.6/whatsnew/changelog.html, https://bugs.python.org/issue27364, https://hg.python.org/cpython/rev/38802c38cfe1, https://github.com/python/cpython/commit/110b6fecbbb86143a4acb568f50eab2c870e7d34

Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from wordnik import swagger
C:\Program Files\Python36\lib\site-packages\wordnik\swagger.py:132: DeprecationWarning: invalid escape sequence \[
  match = re.match('list\[(.*)\]', objClass)
C:\Program Files\Python36\lib\site-packages\wordnik\swagger.py:167: DeprecationWarning: invalid escape sequence \[
  match = re.match('list\[(.*)\]', attrType)

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, https://github.com/python/cpython/pull/9652, https://github.com/python/cpython/commit/6543912c90ffa579dc4c01e811f9609cf92197d3

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.
>>> from wordnik import swagger
C:\Program Files\Python38\lib\site-packages\wordnik\swagger.py:132: SyntaxWarning: invalid escape sequence \[
  match = re.match('list\[(.*)\]', objClass)
C:\Program Files\Python38\lib\site-packages\wordnik\swagger.py:167: SyntaxWarning: invalid escape sequence \[
  match = re.match('list\[(.*)\]', attrType)