pygrok
pygrok copied to clipboard
Deprecation warning due to invalid escape sequences in Python 3.8
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:
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