PEP8 cleanup

This commit is contained in:
Ebag333
2017-03-16 02:12:26 -07:00
parent 80375d1f5b
commit 63f2f85c25
2 changed files with 83 additions and 78 deletions

View File

@@ -128,9 +128,9 @@ class Fit(object):
self.__capRecharge = None self.__capRecharge = None
self.__calculatedTargets = [] self.__calculatedTargets = []
self.__remoteReps = { self.__remoteReps = {
"Armor": None, "Armor" : None,
"Shield": None, "Shield" : None,
"Hull": None, "Hull" : None,
"Capacitor": None, "Capacitor": None,
} }
self.factorReload = False self.factorReload = False
@@ -370,9 +370,11 @@ class Fit(object):
@validates("ID", "ownerID", "shipID") @validates("ID", "ownerID", "shipID")
def validator(self, key, val): def validator(self, key, val):
map = {"ID": lambda _val: isinstance(_val, int), map = {
"ID" : lambda _val: isinstance(_val, int),
"ownerID": lambda _val: isinstance(_val, int) or _val is None, "ownerID": lambda _val: isinstance(_val, int) or _val is None,
"shipID": lambda _val: isinstance(_val, int) or _val is None} "shipID" : lambda _val: isinstance(_val, int) or _val is None
}
if not map[key](val): if not map[key](val):
raise ValueError(str(val) + " is not a valid value for " + key) raise ValueError(str(val) + " is not a valid value for " + key)
@@ -547,14 +549,12 @@ class Fit(object):
stackingPenalties=True) stackingPenalties=True)
if warfareBuffID == 22: # Skirmish Burst: Rapid Deployment: AB/MWD Speed Increase if warfareBuffID == 22: # Skirmish Burst: Rapid Deployment: AB/MWD Speed Increase
self.modules.filteredItemBoost( self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Afterburner") or
lambda mod: mod.item.requiresSkill("Afterburner") mod.item.requiresSkill("High Speed Maneuvering"),
or mod.item.requiresSkill("High Speed Maneuvering"),
"speedFactor", value, stackingPenalties=True) "speedFactor", value, stackingPenalties=True)
if warfareBuffID == 23: # Mining Burst: Mining Laser Field Enhancement: Mining/Survey Range if warfareBuffID == 23: # Mining Burst: Mining Laser Field Enhancement: Mining/Survey Range
self.modules.filteredItemBoost( self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or
lambda mod: mod.item.requiresSkill("Mining") or
mod.item.requiresSkill("Ice Harvesting") or mod.item.requiresSkill("Ice Harvesting") or
mod.item.requiresSkill("Gas Cloud Harvesting"), mod.item.requiresSkill("Gas Cloud Harvesting"),
"maxRange", value, stackingPenalties=True) "maxRange", value, stackingPenalties=True)
@@ -563,14 +563,12 @@ class Fit(object):
"surveyScanRange", value, stackingPenalties=True) "surveyScanRange", value, stackingPenalties=True)
if warfareBuffID == 24: # Mining Burst: Mining Laser Optimization: Mining Capacitor/Duration if warfareBuffID == 24: # Mining Burst: Mining Laser Optimization: Mining Capacitor/Duration
self.modules.filteredItemBoost( self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or
lambda mod: mod.item.requiresSkill("Mining") or
mod.item.requiresSkill("Ice Harvesting") or mod.item.requiresSkill("Ice Harvesting") or
mod.item.requiresSkill("Gas Cloud Harvesting"), mod.item.requiresSkill("Gas Cloud Harvesting"),
"capacitorNeed", value, stackingPenalties=True) "capacitorNeed", value, stackingPenalties=True)
self.modules.filteredItemBoost( self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining") or
lambda mod: mod.item.requiresSkill("Mining") or
mod.item.requiresSkill("Ice Harvesting") or mod.item.requiresSkill("Ice Harvesting") or
mod.item.requiresSkill("Gas Cloud Harvesting"), mod.item.requiresSkill("Gas Cloud Harvesting"),
"duration", value, stackingPenalties=True) "duration", value, stackingPenalties=True)
@@ -850,15 +848,17 @@ class Fit(object):
return amount return amount
slots = {Slot.LOW: "lowSlots", slots = {
Slot.MED: "medSlots", Slot.LOW : "lowSlots",
Slot.HIGH: "hiSlots", Slot.MED : "medSlots",
Slot.RIG: "rigSlots", Slot.HIGH : "hiSlots",
Slot.RIG : "rigSlots",
Slot.SUBSYSTEM: "maxSubSystems", Slot.SUBSYSTEM: "maxSubSystems",
Slot.SERVICE: "serviceSlots", Slot.SERVICE : "serviceSlots",
Slot.F_LIGHT: "fighterLightSlots", Slot.F_LIGHT : "fighterLightSlots",
Slot.F_SUPPORT: "fighterSupportSlots", Slot.F_SUPPORT: "fighterSupportSlots",
Slot.F_HEAVY: "fighterHeavySlots"} Slot.F_HEAVY : "fighterHeavySlots"
}
def getSlotsFree(self, type, countDummies=False): def getSlotsFree(self, type, countDummies=False):
if type in (Slot.MODE, Slot.SYSTEM): if type in (Slot.MODE, Slot.SYSTEM):
@@ -1007,29 +1007,35 @@ class Fit(object):
def calculateSustainableTank(self, effective=True): def calculateSustainableTank(self, effective=True):
if self.__sustainableTank is None: if self.__sustainableTank is None:
if self.capStable: if self.capStable:
sustainable = {"armorRepair": self.extraAttributes["armorRepair"], sustainable = {
"armorRepair" : self.extraAttributes["armorRepair"],
"shieldRepair": self.extraAttributes["shieldRepair"], "shieldRepair": self.extraAttributes["shieldRepair"],
"hullRepair": self.extraAttributes["hullRepair"]} "hullRepair" : self.extraAttributes["hullRepair"]
}
else: else:
sustainable = {} sustainable = {}
repairers = [] repairers = []
# Map a repairer type to the attribute it uses # Map a repairer type to the attribute it uses
groupAttrMap = {"Armor Repair Unit": "armorDamageAmount", groupAttrMap = {
"Armor Repair Unit" : "armorDamageAmount",
"Ancillary Armor Repairer": "armorDamageAmount", "Ancillary Armor Repairer": "armorDamageAmount",
"Hull Repair Unit": "structureDamageAmount", "Hull Repair Unit" : "structureDamageAmount",
"Shield Booster": "shieldBonus", "Shield Booster" : "shieldBonus",
"Ancillary Shield Booster": "shieldBonus", "Ancillary Shield Booster": "shieldBonus",
"Remote Armor Repairer": "armorDamageAmount", "Remote Armor Repairer" : "armorDamageAmount",
"Remote Shield Booster": "shieldBonus"} "Remote Shield Booster" : "shieldBonus"
}
# Map repairer type to attribute # Map repairer type to attribute
groupStoreMap = {"Armor Repair Unit": "armorRepair", groupStoreMap = {
"Hull Repair Unit": "hullRepair", "Armor Repair Unit" : "armorRepair",
"Shield Booster": "shieldRepair", "Hull Repair Unit" : "hullRepair",
"Shield Booster" : "shieldRepair",
"Ancillary Shield Booster": "shieldRepair", "Ancillary Shield Booster": "shieldRepair",
"Remote Armor Repairer": "armorRepair", "Remote Armor Repairer" : "armorRepair",
"Remote Shield Booster": "shieldRepair", "Remote Shield Booster" : "shieldRepair",
"Ancillary Armor Repairer": "armorRepair", } "Ancillary Armor Repairer": "armorRepair",
}
capUsed = self.capUsed capUsed = self.capUsed
for attr in ("shieldRepair", "armorRepair", "hullRepair"): for attr in ("shieldRepair", "armorRepair", "hullRepair"):

View File

@@ -20,7 +20,6 @@
# noinspection PyPackageRequirements # noinspection PyPackageRequirements
import wx import wx
from gui.statsView import StatsView from gui.statsView import StatsView
from gui.bitmapLoader import BitmapLoader
from gui.utils.numberFormatter import formatAmount from gui.utils.numberFormatter import formatAmount