techtonik / python-patch

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

Fix deprecation warnings due to invalid escape sequences. #72

Closed tirkarthi closed 3 years ago

tirkarthi commented 4 years ago

Fixes #71

techtonik commented 3 years ago

I could confirm the deprecation warnings on Python 3:

$ python3 -Walways -m py_compile patch.py 
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)

Thanks! =)