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

Function exportModules

service/port/eft.py:129–163  ·  view source on GitHub ↗
(modules, options, mutaData=None)

Source from the content-addressed store, hash-verified

127
128
129def exportModules(modules, options, mutaData=None):
130 if mutaData is None:
131 mutaData = MutationExportData()
132 modsBySlotType = {}
133 for module in modules:
134 modsBySlotType.setdefault(module.slot, []).append(module)
135 modSection = []
136 for slotType in SLOT_ORDER:
137 rackLines = []
138 rackModules = modsBySlotType.get(slotType, ())
139 for module in rackModules:
140 if module.item:
141 # if module was mutated, use base item name for export
142 if module.isMutated:
143 modName = module.baseItem.typeName
144 else:
145 modName = module.item.typeName
146 if module.isMutated and options[PortEftOptions.MUTATIONS]:
147 mutaData.mutants[mutaData.reference] = module
148 mutationSuffix = ' [{}]'.format(mutaData.reference)
149 mutaData.reference += 1
150 else:
151 mutationSuffix = ''
152 modOfflineSuffix = ' {}'.format(OFFLINE_SUFFIX) if module.state == FittingModuleState.OFFLINE else ''
153 if module.charge and options[PortEftOptions.LOADED_CHARGES]:
154 rackLines.append('{}, {}{}{}'.format(
155 modName, module.charge.typeName, modOfflineSuffix, mutationSuffix))
156 else:
157 rackLines.append('{}{}{}'.format(modName, modOfflineSuffix, mutationSuffix))
158 else:
159 rackLines.append('[Empty {} slot]'.format(
160 FittingSlot(slotType).name.capitalize() if slotType is not None else ''))
161 if rackLines:
162 modSection.append('\n'.join(rackLines))
163 return '\n\n'.join(modSection)
164
165
166def exportDrones(drones, exportMutants=True, mutaData=None, standAlone=True):

Callers 1

exportEftFunction · 0.85

Calls 4

FittingSlotClass · 0.90
MutationExportDataClass · 0.85
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected