MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / importGetMutationData

Function importGetMutationData

service/port/eft.py:597–635  ·  view source on GitHub ↗
(lines)

Source from the content-addressed store, hash-verified

595
596
597def 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
638def _importSectionIter(lines):

Callers 3

activateMethod · 0.90
importEftFunction · 0.85
isValidDroneImportFunction · 0.85

Calls 4

parseMutantFunction · 0.90
completeMutaLinesFunction · 0.85
itemsMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected