pybootchartgui.py: python 3.12+ regexes
PATCH 1/1 pybootchartgui.py: python 3.12+ regexes
From: Adrian Freihofer <[email protected]>
$ ./scripts/pybootchartgui/pybootchartgui.py
./scripts/pybootchartgui/pybootchartgui/parsing.py:460: SyntaxWarning: invalid escape sequence '\d'
disk_regex_re = re.compile ('^([hsv]d.|mtdblock\d|mmcblk\d|cciss/c\d+d\d+.*)$')
./scripts/pybootchartgui/pybootchartgui/parsing.py:597: SyntaxWarning: invalid escape sequence '\['
timestamp_re = re.compile ("^\[\s*(\d+\.\d+)\s*]\s+(.*)$")
./scripts/pybootchartgui/pybootchartgui/parsing.py:598: SyntaxWarning: invalid escape sequence '\S'
split_re = re.compile ("^(\S+)\s+([\S\+_-]+) (.*)$")
./scripts/pybootchartgui/pybootchartgui/parsing.py:643: SyntaxWarning: invalid escape sequence '\@'
p = re.match ("\@ (\d+)", rest)
./scripts/pybootchartgui/pybootchartgui/draw.py:799: SyntaxWarning: invalid escape sequence '\s'
('system.cpu', 'CPU', lambda s: re.sub('model name\s*:\s*', '', s, 1)),Signed-off-by Adrian Freihofer <[email protected]>
--- scripts/pybootchartgui/pybootchartgui/parsing.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
scripts/pybootchartgui/pybootchartgui/parsing.py +5 -5
@@ -457,7 +457,7 @@ def _parse_proc_disk_stat_log(file): not sda1, sda2 etc. The format of relevant lines should be: {major minor name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq} """ - disk_regex_re = re.compile ('^([hsv]d.|mtdblock\d|mmcblk\d|cciss/c\d+d\d+.*)$') + disk_regex_re = re.compile (r'^([hsv]d.|mtdblock\d|mmcblk\d|cciss/c\d+d\d+.*)$') # this gets called an awful lot. def is_relevant_line(linetokens):
@@ -594,8 +594,8 @@ def _parse_pressure_logs(file, filename): # [ 0.039993] calling migration_init+0x0/0x6b @ 1 # [ 0.039993] initcall migration_init+0x0/0x6b returned 1 after 0 usecs def _parse_dmesg(writer, file): - timestamp_re = re.compile ("^\[\s*(\d+\.\d+)\s*]\s+(.*)$") - split_re = re.compile ("^(\S+)\s+([\S\+_-]+) (.*)$") + timestamp_re = re.compile (r"^\[\s*(\d+\.\d+)\s*]\s+(.*)$") + split_re = re.compile (r"^(\S+)\s+([\S\+_-]+) (.*)$") processMap = {} idx = 0 inc = 1.0 / 1000000
@@ -640,7 +640,7 @@ def _parse_dmesg(writer, file): # print "foo: '%s' '%s' '%s'" % (type, func, rest) if type == "calling": ppid = kernel.pid - p = re.match ("\@ (\d+)", rest) + p = re.match (r"\@ (\d+)", rest) if p is not None: ppid = float (p.group(1)) // 1000 # print "match: '%s' ('%g') at '%s'" % (func, ppid, time_ms)
@@ -742,7 +742,7 @@ def get_num_cpus(headers): cpu_model = headers.get("system.cpu") if cpu_model is None: return 1 - mat = re.match(".*\\((\\d+)\\)", cpu_model) + mat = re.match(r".*\\((\\d+)\\)", cpu_model) if mat is None: return 1 return max (int(mat.group(1)), 1)
Signature · 1 line
2.45.2