conan-io / python-patch-ng

Library to parse and apply unified diffs

Home Page:https://pypi.org/project/patch-ng

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecation warnings over invalid escape sequences in Python 3.7

tirkarthi opened this issue · comments

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_ng.py:420: DeprecationWarning: invalid escape sequence \d
  re_hunk_start = re.compile(b"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@")
./patch_ng.py:614: DeprecationWarning: invalid escape sequence \+
  re_filename_date_time = b"^\+\+\+ ([^\t]+)(?:\s([0-9-]+)\s([0-9:]+)|.*)"
./patch_ng.py:571: DeprecationWarning: invalid escape sequence \s
  re_filename_date_time = b"^--- ([^\t]+)(?:\s([0-9-]+)\s([0-9:]+)|.*)"
./patch_ng.py:646: DeprecationWarning: invalid escape sequence \d
  match = re.match(b"^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@(.*)", line)

This became a SyntaxWarning with Python 3.12.