summaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui/pybootchartgui/parsing.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/parsing.py')
-rw-r--r--scripts/pybootchartgui/pybootchartgui/parsing.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index bcfb2da569..ef2d3d309c 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -267,7 +267,7 @@ def _parse_headers(file):
267 value = line.strip() 267 value = line.strip()
268 headers[last] += value 268 headers[last] += value
269 return headers, last 269 return headers, last
270 return reduce(parse, file.read().decode('utf-8').split('\n'), (defaultdict(str),''))[0] 270 return reduce(parse, file.read().split('\n'), (defaultdict(str),''))[0]
271 271
272def _parse_timed_blocks(file): 272def _parse_timed_blocks(file):
273 """Parses (ie., splits) a file into so-called timed-blocks. A 273 """Parses (ie., splits) a file into so-called timed-blocks. A
@@ -281,7 +281,7 @@ def _parse_timed_blocks(file):
281 return (int(lines[0]), lines[1:]) 281 return (int(lines[0]), lines[1:])
282 except ValueError: 282 except ValueError:
283 raise ParseError("expected a timed-block, but timestamp '%s' is not an integer" % lines[0]) 283 raise ParseError("expected a timed-block, but timestamp '%s' is not an integer" % lines[0])
284 blocks = file.read().decode('utf-8').split('\n\n') 284 blocks = file.read().split('\n\n')
285 return [parse(block) for block in blocks if block.strip() and not block.endswith(' not running\n')] 285 return [parse(block) for block in blocks if block.strip() and not block.endswith(' not running\n')]
286 286
287def _parse_proc_ps_log(writer, file): 287def _parse_proc_ps_log(writer, file):
@@ -577,7 +577,7 @@ def _parse_dmesg(writer, file):
577 processMap['k-boot'] = kernel 577 processMap['k-boot'] = kernel
578 base_ts = False 578 base_ts = False
579 max_ts = 0 579 max_ts = 0
580 for line in file.read().decode('utf-8').split('\n'): 580 for line in file.read().split('\n'):
581 t = timestamp_re.match (line) 581 t = timestamp_re.match (line)
582 if t is None: 582 if t is None:
583# print "duff timestamp " + line 583# print "duff timestamp " + line
@@ -665,7 +665,7 @@ def _parse_pacct(writer, file):
665def _parse_paternity_log(writer, file): 665def _parse_paternity_log(writer, file):
666 parent_map = {} 666 parent_map = {}
667 parent_map[0] = 0 667 parent_map[0] = 0
668 for line in file.read().decode('utf-8').split('\n'): 668 for line in file.read().split('\n'):
669 if not line: 669 if not line:
670 continue 670 continue
671 elems = line.split(' ') # <Child> <Parent> 671 elems = line.split(' ') # <Child> <Parent>
@@ -678,7 +678,7 @@ def _parse_paternity_log(writer, file):
678 678
679def _parse_cmdline_log(writer, file): 679def _parse_cmdline_log(writer, file):
680 cmdLines = {} 680 cmdLines = {}
681 for block in file.read().decode('utf-8').split('\n\n'): 681 for block in file.read().split('\n\n'):
682 lines = block.split('\n') 682 lines = block.split('\n')
683 if len (lines) >= 3: 683 if len (lines) >= 3:
684# print "Lines '%s'" % (lines[0]) 684# print "Lines '%s'" % (lines[0])
@@ -751,7 +751,7 @@ def parse_file(writer, state, filename):
751 if state.filename is None: 751 if state.filename is None:
752 state.filename = filename 752 state.filename = filename
753 basename = os.path.basename(filename) 753 basename = os.path.basename(filename)
754 with open(filename, "rb") as file: 754 with open(filename, "r") as file:
755 return _do_parse(writer, state, filename, file) 755 return _do_parse(writer, state, filename, file)
756 756
757def parse_paths(writer, state, paths): 757def parse_paths(writer, state, paths):