pygrok icon indicating copy to clipboard operation
pygrok copied to clipboard

Deprecation warning due to invalid escape sequences in Python 3.8

Open tirkarthi opened this issue 5 years ago • 1 comments

find . -iname '*.py'  | xargs -P 4 -I{} python3.8 -Wall -m py_compile {}

./tests/test_pygrok.py:89: DeprecationWarning: invalid escape sequence \[
  pat = '%{HOSTNAME:host} %{IP:client_ip} %{NUMBER:delay}s - \[%{DATA:time_stamp}\]' \
./pygrok/pygrok.py:85: DeprecationWarning: invalid escape sequence \w
  if re.search('%{\w+(:\w+)?}', py_regex_pattern) is None:

tirkarthi avatar Jan 31 '20 15:01 tirkarthi

Looks like that line is missing the leading r to make it a literal. All of these other lines already have the r: https://github.com/garyelephant/pygrok/blob/de9e3f92f5a52f0fc101aaa0f694f52aee6afba8/pygrok/pygrok.py#L70 https://github.com/garyelephant/pygrok/blob/de9e3f92f5a52f0fc101aaa0f694f52aee6afba8/pygrok/pygrok.py#L76 https://github.com/garyelephant/pygrok/blob/de9e3f92f5a52f0fc101aaa0f694f52aee6afba8/pygrok/pygrok.py#L81

It's an easy fix

goldstar611 avatar Jul 31 '20 20:07 goldstar611