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

Function _importCreateFit

service/port/eft.py:651–673  ·  view source on GitHub ↗

Create fit and set top-level entity (ship or citadel).

(lines)

Source from the content-addressed store, hash-verified

649
650
651def _importCreateFit(lines):
652 """Create fit and set top-level entity (ship or citadel)."""
653 fit = Fit()
654 header = lines.pop(0)
655 m = re.match(r'\[(?P<shipType>[^,]+),\s*(?P<fitName>.+)\]', header)
656 if not m:
657 pyfalog.warning('service.port.eft.importEft: corrupted fit header')
658 raise EftImportError
659 shipType = m.group('shipType').strip()
660 fitName = m.group('fitName').strip()
661 try:
662 ship = fetchItem(shipType)
663 try:
664 fit.ship = Ship(ship)
665 except ValueError:
666 fit.ship = Citadel(ship)
667 fit.name = fitName
668 except (KeyboardInterrupt, SystemExit):
669 raise
670 except:
671 pyfalog.warning('service.port.eft.importEft: exception caught when parsing header')
672 raise EftImportError
673 return fit
674
675
676def _clearTail(lst):

Callers 1

importEftFunction · 0.85

Calls 4

FitClass · 0.90
fetchItemFunction · 0.90
ShipClass · 0.90
CitadelClass · 0.90

Tested by

no test coverage detected