No need to use .value for IntEnums

This commit is contained in:
DarkPhoenix
2019-03-21 12:55:39 +03:00
parent 5940625e24
commit cdaf5cc168
2 changed files with 15 additions and 15 deletions

View File

@@ -43,9 +43,9 @@ from service.port.shared import IPortUser, fetchItem, processing_notify
pyfalog = Logger(__name__)
EFT_OPTIONS = (
(PortEftOptions.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortEftOptions.MUTATIONS.value, 'Mutated Attributes', 'Export mutated modules\' stats', True),
(PortEftOptions.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', True),
(PortEftOptions.LOADED_CHARGES, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortEftOptions.MUTATIONS, 'Mutated Attributes', 'Export mutated modules\' stats', True),
(PortEftOptions.IMPLANTS, 'Implants && Boosters', 'Export implants and boosters', True),
)
@@ -80,14 +80,14 @@ def exportEft(fit, options, callback):
modName = module.baseItem.name
else:
modName = module.item.name
if module.isMutated and options[PortEftOptions.MUTATIONS.value]:
if module.isMutated and options[PortEftOptions.MUTATIONS]:
mutants[mutantReference] = module
mutationSuffix = ' [{}]'.format(mutantReference)
mutantReference += 1
else:
mutationSuffix = ''
modOfflineSuffix = ' {}'.format(OFFLINE_SUFFIX) if module.state == FittingModuleState.OFFLINE else ''
if module.charge and options[PortEftOptions.LOADED_CHARGES.value]:
if module.charge and options[PortEftOptions.LOADED_CHARGES]:
rackLines.append('{}, {}{}{}'.format(
modName, module.charge.name, modOfflineSuffix, mutationSuffix))
else:
@@ -116,7 +116,7 @@ def exportEft(fit, options, callback):
sections.append('\n\n'.join(minionSection))
# Section 3: implants, boosters
if options[PortEftOptions.IMPLANTS.value]:
if options[PortEftOptions.IMPLANTS]:
charSection = []
implantLines = []
for implant in fit.implants:
@@ -143,7 +143,7 @@ def exportEft(fit, options, callback):
# Section 5: mutated modules' details
mutationLines = []
if mutants and options[PortEftOptions.MUTATIONS.value]:
if mutants and options[PortEftOptions.MUTATIONS]:
for mutantReference in sorted(mutants):
mutant = mutants[mutantReference]
mutationLines.append(renderMutant(mutant, firstPrefix='[{}] '.format(mutantReference), prefix=' '))

View File

@@ -23,10 +23,10 @@ from service.price import Price as sPrc
MULTIBUY_OPTIONS = (
(PortMultiBuyOptions.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortMultiBuyOptions.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', False),
(PortMultiBuyOptions.CARGO.value, 'Cargo', 'Export cargo contents', True),
(PortMultiBuyOptions.OPTIMIZE_PRICES.value, 'Optimize Prices', 'Replace items by cheaper alternatives', False),
(PortMultiBuyOptions.LOADED_CHARGES, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortMultiBuyOptions.IMPLANTS, 'Implants && Boosters', 'Export implants and boosters', False),
(PortMultiBuyOptions.CARGO, 'Cargo', 'Export cargo contents', True),
(PortMultiBuyOptions.OPTIMIZE_PRICES, 'Optimize Prices', 'Replace items by cheaper alternatives', False),
)
@@ -39,7 +39,7 @@ def exportMultiBuy(fit, options, callback):
if module.isMutated:
continue
_addItem(itemAmounts, module.item)
if module.charge and options[PortMultiBuyOptions.LOADED_CHARGES.value]:
if module.charge and options[PortMultiBuyOptions.LOADED_CHARGES]:
_addItem(itemAmounts, module.charge, module.numCharges)
for drone in fit.drones:
@@ -48,18 +48,18 @@ def exportMultiBuy(fit, options, callback):
for fighter in fit.fighters:
_addItem(itemAmounts, fighter.item, fighter.amountActive)
if options[PortMultiBuyOptions.CARGO.value]:
if options[PortMultiBuyOptions.CARGO]:
for cargo in fit.cargo:
_addItem(itemAmounts, cargo.item, cargo.amount)
if options[PortMultiBuyOptions.IMPLANTS.value]:
if options[PortMultiBuyOptions.IMPLANTS]:
for implant in fit.implants:
_addItem(itemAmounts, implant.item)
for booster in fit.boosters:
_addItem(itemAmounts, booster.item)
if options[PortMultiBuyOptions.OPTIMIZE_PRICES.value]:
if options[PortMultiBuyOptions.OPTIMIZE_PRICES]:
def formatCheaperExportCb(replacementsCheaper):
updatedAmounts = {}