pyCharm inspection fixes. Mostly variable refernce issues

This commit is contained in:
Ebag333
2017-02-08 17:55:20 -08:00
parent de87c992d7
commit 3e916e42f2
24 changed files with 70 additions and 51 deletions

View File

@@ -27,7 +27,8 @@ from service.fit import Fit
class BoosterViewDrop(wx.PyDropTarget):
def __init__(self, dropFn):
def __init__(self, dropFn, *args, **kwargs):
super(BoosterViewDrop, self).__init__(*args, **kwargs)
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID

View File

@@ -157,7 +157,7 @@ class ModuleAmmoPicker(ContextMenu):
item = self.addCharge(rootMenu if msw else m, charge)
items.append(item)
else:
if sub is None:
if sub is None and item and base:
sub = wx.Menu()
sub.Bind(wx.EVT_MENU, self.handleAmmoSwitch)
self.addSeperator(sub, "Less Damage")

View File

@@ -9,6 +9,7 @@ from service.fit import Fit
class ModuleGlobalAmmoPicker(ModuleAmmoPicker):
def __init__(self):
super(ModuleGlobalAmmoPicker, self).__init__()
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def getText(self, itmContext, selection):

View File

@@ -216,52 +216,61 @@ class ResourcesViewFull(StatsView):
("label%sTotalCargoBay", lambda: fit.ship.getModifiedItemAttr("capacity"), 3, 0, 9),
)
panel = "Full"
usedTurretHardpoints = 0
labelUTH = ""
totalTurretHardpoints = 0
labelTTH = ""
usedLauncherHardpoints = 0
labelULH = ""
totalLauncherHardPoints = 0
labelTLH = ""
usedDronesActive = 0
labelUDA = ""
totalDronesActive = 0
labelTDA = ""
usedFighterTubes = 0
labelUFT = ""
totalFighterTubes = 0
labelTFT = ""
usedCalibrationPoints = 0
labelUCP = ""
totalCalibrationPoints = 0
labelTCP = ""
for labelName, value, prec, lowest, highest in stats:
label = getattr(self, labelName % panel)
value = value() if fit is not None else 0
value = value if value is not None else 0
if labelName % panel == "label%sUsedTurretHardpoints" % panel:
usedTurretHardpoints = value
labelUTH = label
if labelName % panel == "label%sTotalTurretHardpoints" % panel:
elif labelName % panel == "label%sTotalTurretHardpoints" % panel:
totalTurretHardpoints = value
labelTTH = label
if labelName % panel == "label%sUsedLauncherHardpoints" % panel:
elif labelName % panel == "label%sUsedLauncherHardpoints" % panel:
usedLauncherHardpoints = value
labelULH = label
if labelName % panel == "label%sTotalLauncherHardpoints" % panel:
elif labelName % panel == "label%sTotalLauncherHardpoints" % panel:
totalLauncherHardPoints = value
labelTLH = label
if labelName % panel == "label%sUsedDronesActive" % panel:
elif labelName % panel == "label%sUsedDronesActive" % panel:
usedDronesActive = value
labelUDA = label
if labelName % panel == "label%sTotalDronesActive" % panel:
elif labelName % panel == "label%sTotalDronesActive" % panel:
totalDronesActive = value
labelTDA = label
if labelName % panel == "label%sUsedFighterTubes" % panel:
elif labelName % panel == "label%sUsedFighterTubes" % panel:
usedFighterTubes = value
labelUFT = label
if labelName % panel == "label%sTotalFighterTubes" % panel:
elif labelName % panel == "label%sTotalFighterTubes" % panel:
totalFighterTubes = value
labelTFT = label
if labelName % panel == "label%sUsedCalibrationPoints" % panel:
elif labelName % panel == "label%sUsedCalibrationPoints" % panel:
usedCalibrationPoints = value
labelUCP = label
if labelName % panel == "label%sTotalCalibrationPoints" % panel:
elif labelName % panel == "label%sTotalCalibrationPoints" % panel:
totalCalibrationPoints = value
labelTCP = label
@@ -316,6 +325,8 @@ class ResourcesViewFull(StatsView):
lambda: fit.ship.getModifiedItemAttr("droneBandwidth"),
lambda: fit.ship.getModifiedItemAttr("capacity"),
)
else:
resMax = None
i = 0
for resourceType in ("cpu", "pg", "droneBay", "fighterBay", "droneBandwidth", "cargoBay"):

View File

@@ -97,7 +97,8 @@ FitSpawner.register()
# Drag'n'drop handler
class FittingViewDrop(wx.PyDropTarget):
def __init__(self, dropFn):
def __init__(self, dropFn, *args, **kwargs):
super(FittingViewDrop, self).__init__(*args, **kwargs)
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID

View File

@@ -27,7 +27,8 @@ from service.market import Market
class CargoViewDrop(wx.PyDropTarget):
def __init__(self, dropFn):
def __init__(self, dropFn, *args, **kwargs):
super(CargoViewDrop, self).__init__(*args, **kwargs)
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID

View File

@@ -1268,6 +1268,7 @@ class PFTabsContainer(wx.Panel):
pos = tabsWidth
selected = None
selpos = None
for i in range(len(self.tabs) - 1, -1, -1):
tab = self.tabs[i]
width = tab.tabWidth - self.inclination * 2

View File

@@ -40,7 +40,8 @@ class DummyEntry:
class CommandViewDrop(wx.PyDropTarget):
def __init__(self, dropFn):
def __init__(self, dropFn, *args, **kwargs):
super(CommandViewDrop, self).__init__(*args, **kwargs)
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID

View File

@@ -144,10 +144,10 @@ class CrestFittings(wx.Frame):
self.updateCacheStatus(None)
self.cacheTimer.Start(1000)
self.fitTree.populateSkillTree(fittings)
del waitDialog
except requests.exceptions.ConnectionError:
self.statusbar.SetStatusText("Connection error, please check your internet connection")
finally:
del waitDialog
def importFitting(self, event):
selection = self.fitView.fitSelection

View File

@@ -29,7 +29,8 @@ from service.market import Market
class DroneViewDrop(wx.PyDropTarget):
def __init__(self, dropFn):
def __init__(self, dropFn, *args, **kwargs):
super(DroneViewDrop, self).__init__(*args, **kwargs)
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID

View File

@@ -31,7 +31,8 @@ from service.market import Market
class FighterViewDrop(wx.PyDropTarget):
def __init__(self, dropFn):
def __init__(self, dropFn, *args, **kwargs):
super(FighterViewDrop, self).__init__(*args, **kwargs)
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID

View File

@@ -55,7 +55,7 @@ from gui.graphFrame import GraphFrame
from gui.copySelectDialog import CopySelectDialog
from gui.utils.clipboard import toClipboard, fromClipboard
from gui.updateDialog import UpdateDialog
from gui.builtinViews import emptyView, entityEditor, fittingView, implantEditor
from gui.builtinViews import emptyView, entityEditor, fittingView, implantEditor # noqa: F401
from gui import graphFrame
from service.settings import SettingsProvider
@@ -136,7 +136,7 @@ class MainFrame(wx.Frame):
@classmethod
def getInstance(cls):
return cls.__instance if cls.__instance is not None else MainFrame()
return cls.__instance if cls.__instance is not None else MainFrame("")
def __init__(self, title):
self.title = title

View File

@@ -82,6 +82,7 @@ class MarketBrowser(wx.Panel):
p.SetSizer(box)
vbox.Add(p, 0, wx.EXPAND)
self.metaButtons = []
btn = None
for name in self.sMkt.META_MAP.keys():
btn = MetaButton(p, wx.ID_ANY, name.capitalize(), style=wx.BU_EXACTFIT)
setattr(self, name, btn)

View File

@@ -42,7 +42,8 @@ class DummyEntry:
class ProjectedViewDrop(wx.PyDropTarget):
def __init__(self, dropFn):
def __init__(self, dropFn, *args, **kwargs):
super(ProjectedViewDrop, self).__init__(*args, **kwargs)
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID

View File

@@ -197,6 +197,8 @@ class ResistsEditorDlg(wx.Dialog):
if self.block:
return
editObj = None
try:
p = self.entityEditor.getActiveEntity()

View File

@@ -31,6 +31,7 @@ class OrderedDict(dict):
because their insertion order is arbitrary.
'''
super(OrderedDict, self).__init__(**kwds)
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
@@ -194,8 +195,10 @@ class OrderedDict(dict):
self[key] = default
return default
def __repr__(self, _repr_running={}):
def __repr__(self, _repr_running=None):
'od.__repr__() <==> repr(od)'
if _repr_running is None:
_repr_running = {}
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'