INNER CODE UNIT · Python
extract_section
crocs-muni/JCAlgTest · AlgTest_Process/process_results.py:61
def extract_section(lines: list, start_string: str, perf_measurement: bool):
all_sections = []
i = 0
while i < len(lines):
if lines[i].startswith(start_string): # detect start of the section to extract
just_entered = True
section_items = {}
while i < len(lines) and len(lines[i]) > 0: # process section till its end (newline)
if not just_entered and lines[i].startswith(start_string): # check if we hit another section
# we hit start fo another section - finish and let next section to be processed
i = i - 1
break
pos = lines[i].find(';')
if pos == -1:
pos = len(lines[i])
if pos > 0:
key = lines[i][0: pos].strip()