Avoid syntax warning in newer python versions
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 24 Jun 2025 11:38:18 +0000 (13:38 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 24 Jun 2025 11:56:49 +0000 (13:56 +0200)
Parser does not realize that these regular expressions are part of comments

src/sysmisc.py

index 3a2b0cd..47d6d43 100644 (file)
@@ -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 "(.+)"