From: Christian Herdtweck Date: Tue, 24 Jun 2025 11:38:18 +0000 (+0200) Subject: Avoid syntax warning in newer python versions X-Git-Tag: v1.7.4~1^2~2 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=27fb89d38aa2abd862d44c67510e1c57be38fcc2;p=pyi2ncommon Avoid syntax warning in newer python versions Parser does not realize that these regular expressions are part of comments --- diff --git a/src/sysmisc.py b/src/sysmisc.py index 3a2b0cd..47d6d43 100644 --- a/src/sysmisc.py +++ b/src/sysmisc.py @@ -54,7 +54,7 @@ The library exports the symbols below and some custom logging functions. import re import sysmisc def parse(line): - if re.match(r'\d', line): + if re.match('\\d', line): print('found digits in line!') sysmisc.read_linewise('dump_db', parse) @@ -415,7 +415,7 @@ def replace_file_regex(edited_file, value, regex=None, ignore_fail=False): in order to avoid any mismatch. Example: - provider.cnf, 'PROVIDER_LOCALIP,0: "(\d+)"', 127.0.0.1 + provider.cnf, 'PROVIDER_LOCALIP,0: "(\\d+)"', 127.0.0.1 """ pattern = regex.encode() if regex else "(.+)"