techtonik / python-patch

Library to parse and apply unified diffs
https://pypi.python.org/pypi/patch
106 stars 63 forks source link

Deprecation warnings over invalid escape sequences in Python 3.7 #71

Closed tirkarthi closed 3 years ago

tirkarthi commented 4 years ago

Deprecation warning are generated over invalid escape sequences. This can be fixed by using raw strings or escaping the literals again.

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

./patch.py:340: DeprecationWarning: invalid escape sequence \d
  re_hunk_start = re.compile(b"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@")
./patch.py:519: DeprecationWarning: invalid escape sequence \+
  re_filename = b"^\+\+\+ ([^\t]+)"
./patch.py:545: DeprecationWarning: invalid escape sequence \d
  match = re.match(b"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@(.*)", line)