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

Function getSimilarModPositions

gui/fitCommands/helpers.py:396–426  ·  view source on GitHub ↗
(mods, mainMod)

Source from the content-addressed store, hash-verified

394
395
396def getSimilarModPositions(mods, mainMod):
397 sMkt = Market.getInstance()
398 mainGroupID = getattr(sMkt.getGroupByItem(mainMod.item), 'ID', None)
399 mainMktGroupID = getattr(sMkt.getMarketGroupByItem(mainMod.item), 'ID', None)
400 mainEffects = set(getattr(mainMod.item, 'effects', ()))
401 positions = []
402 for position, mod in enumerate(mods):
403 if mod.isEmpty:
404 continue
405 # Always include selected module itself
406 if mod is mainMod:
407 positions.append(position)
408 continue
409 if mod.itemID is None:
410 continue
411 # Modules which have the same item ID
412 if mod.itemID == mainMod.itemID:
413 positions.append(position)
414 continue
415 # And modules from the same group and market group too
416 modGroupID = getattr(sMkt.getGroupByItem(mod.item), 'ID', None)
417 modMktGroupID = getattr(sMkt.getMarketGroupByItem(mod.item), 'ID', None)
418 modEffects = set(getattr(mod.item, 'effects', ()))
419 if (
420 modGroupID is not None and modGroupID == mainGroupID and
421 modMktGroupID is not None and modMktGroupID == mainMktGroupID and
422 modEffects == mainEffects
423 ):
424 positions.append(position)
425 continue
426 return positions
427
428
429def getSimilarFighters(fighters, mainFighter):

Callers 11

removeItemMethod · 0.90
addModuleMethod · 0.90
clickMethod · 0.90
__handleModuleMethod · 0.90
__handleProjectedItemMethod · 0.90
__handleModuleMethod · 0.90
activateMethod · 0.90
handleAmmoSwitchMethod · 0.90
clickMethod · 0.90
onLeftDoubleClickMethod · 0.90

Calls 4

getGroupByItemMethod · 0.80
getMarketGroupByItemMethod · 0.80
getInstanceMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected