h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
582 stars 85 forks source link

Deprecation warning due to invalid escape sequences in Python 3.8 #33

Closed tirkarthi closed 1 year ago

tirkarthi commented 4 years ago

Deprecation warnings are raised due to invalid escape sequences in Python 3.8 . Below is a log of the warnings raised during compiling all the python files. Using raw strings or escaping them will fix this issue.

find . -iname '*.py'  | xargs -P 4 -I{} python -Walways -m py_compile {}

./jsonpath_ng/ext/string.py:18: DeprecationWarning: invalid escape sequence \(
  SUB = re.compile("sub\(/(.*)/,\s+(.*)\)")
./jsonpath_ng/ext/string.py:19: DeprecationWarning: invalid escape sequence \(
  SPLIT = re.compile("split\((.),\s+(\d+),\s+(\d+|-1)\)")
./tests/test_jsonpath_rw_ext.py:129: DeprecationWarning: invalid escape sequence \c
  ('sort2', dict(string='objects[\cat]',
./tests/test_jsonpath_rw_ext.py:132: DeprecationWarning: invalid escape sequence \c
  ('sort2_indexed', dict(string='objects[\cat][-1].cat',
./tests/test_jsonpath_rw_ext.py:136: DeprecationWarning: invalid escape sequence \c
  ('sort3', dict(string='objects[/cow,\cat]',
./tests/test_jsonpath_rw_ext.py:145: DeprecationWarning: invalid escape sequence \c
  ('sort3_indexed', dict(string='objects[/cow,\cat][0].cat',