Create fit and set top-level entity (ship or citadel).
(lines)
| 649 | |
| 650 | |
| 651 | def _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 | |
| 676 | def _clearTail(lst): |