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

Method isValidCharge

eos/saveddata/module.py:808–831  ·  view source on GitHub ↗
(self, charge)

Source from the content-addressed store, hash-verified

806 return True
807
808 def isValidCharge(self, charge):
809 # Check sizes, if 'charge size > module volume' it won't fit
810 if charge is None:
811 return True
812 chargeVolume = charge.attributes['volume'].value
813 moduleCapacity = self.item.attributes['capacity'].value
814 if chargeVolume is not None and moduleCapacity is not None and chargeVolume > moduleCapacity:
815 return False
816
817 itemChargeSize = self.getModifiedItemAttr("chargeSize")
818 if itemChargeSize > 0:
819 chargeSize = charge.getAttribute('chargeSize')
820 if itemChargeSize != chargeSize:
821 return False
822
823 chargeGroup = charge.groupID
824 for i in range(5):
825 itemChargeGroup = self.getModifiedItemAttr('chargeGroup' + str(i), None)
826 if not itemChargeGroup:
827 continue
828 if itemChargeGroup == chargeGroup:
829 return True
830
831 return False
832
833 def getValidCharges(self):
834 validCharges = set()

Callers 6

__makeModuleMethod · 0.95
getValidChargesMethod · 0.95
rebaseMethod · 0.95
DoMethod · 0.80
DoMethod · 0.80
DoMethod · 0.80

Calls 2

getAttributeMethod · 0.80
getModifiedItemAttrMethod · 0.45

Tested by

no test coverage detected