(lines)
| 595 | |
| 596 | |
| 597 | def importGetMutationData(lines): |
| 598 | # Format: {ref: [lines]} |
| 599 | mutaLinesMap = {} |
| 600 | currentMutaRef = None |
| 601 | currentMutaLines = [] |
| 602 | consumedIndices = set() |
| 603 | |
| 604 | def completeMutaLines(): |
| 605 | if currentMutaRef is not None and currentMutaLines: |
| 606 | mutaLinesMap[currentMutaRef] = currentMutaLines |
| 607 | |
| 608 | for i, line in enumerate(lines): |
| 609 | m = mutantHeaderPattern.match(line) |
| 610 | # Start and reset at header line |
| 611 | if m: |
| 612 | completeMutaLines() |
| 613 | currentMutaRef = int(m.group('ref')) |
| 614 | currentMutaLines = [] |
| 615 | currentMutaLines.append(m.group('tail')) |
| 616 | consumedIndices.add(i) |
| 617 | # Reset at blank line |
| 618 | elif not line: |
| 619 | completeMutaLines() |
| 620 | currentMutaRef = None |
| 621 | currentMutaLines = [] |
| 622 | elif currentMutaRef is not None: |
| 623 | currentMutaLines.append(line) |
| 624 | consumedIndices.add(i) |
| 625 | else: |
| 626 | completeMutaLines() |
| 627 | # Clear mutant info from source |
| 628 | for i in sorted(consumedIndices, reverse=True): |
| 629 | del lines[i] |
| 630 | # Run parsing |
| 631 | data = {} |
| 632 | for ref, mutaLines in mutaLinesMap.items(): |
| 633 | _, mutaType, mutaAttrs = parseMutant(mutaLines) |
| 634 | data[ref] = (mutaType, mutaAttrs) |
| 635 | return data |
| 636 | |
| 637 | |
| 638 | def _importSectionIter(lines): |
no test coverage detected