Create variables before they are referenced.
Resolves attribute reference validation errors in pyCharm
This commit is contained in:
@@ -57,6 +57,7 @@ projectedFits_table = Table("projectedFits", saveddata_meta,
|
||||
|
||||
class ProjectedFit(object):
|
||||
def __init__(self, sourceID, source_fit, amount=1, active=True):
|
||||
self.victim_fit = None
|
||||
self.sourceID = sourceID
|
||||
self.source_fit = source_fit
|
||||
self.active = active
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
# ===============================================================================
|
||||
|
||||
class EqBase(object):
|
||||
def __init__(self):
|
||||
self.ID = None
|
||||
|
||||
def __eq__(self, other):
|
||||
return type(self) == type(other) and self.ID == other.ID
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ class Effect(EqBase):
|
||||
# Filter to change names of effects to valid python method names
|
||||
nameFilter = re.compile("[^A-Za-z0-9]")
|
||||
|
||||
def __init__(self):
|
||||
super(Effect, self).__init__()
|
||||
self.name = None
|
||||
|
||||
@reconstructor
|
||||
def init(self):
|
||||
"""
|
||||
@@ -167,6 +171,14 @@ class Item(EqBase):
|
||||
|
||||
MOVE_ATTR_INFO = None
|
||||
|
||||
def __init__(self):
|
||||
super(Item, self).__init__()
|
||||
self.raceID = None
|
||||
self.factionID = None
|
||||
self.category = None
|
||||
self.ID = None
|
||||
self.effects = None
|
||||
|
||||
@classmethod
|
||||
def getMoveAttrInfo(cls):
|
||||
info = getattr(cls, "MOVE_ATTR_INFO", None)
|
||||
@@ -413,6 +425,13 @@ class Icon(EqBase):
|
||||
|
||||
|
||||
class MarketGroup(EqBase):
|
||||
def __init__(self):
|
||||
super(MarketGroup, self).__init__()
|
||||
self.name = None
|
||||
self.parent = None
|
||||
self.name = None
|
||||
self.ID = None
|
||||
|
||||
def __repr__(self):
|
||||
return u"MarketGroup(ID={}, name={}, parent={}) at {}".format(
|
||||
self.ID, self.name, getattr(self.parent, "name", None), self.name, hex(id(self))
|
||||
|
||||
@@ -25,6 +25,9 @@ cappingAttrKeyCache = {}
|
||||
|
||||
|
||||
class ItemAttrShortcut(object):
|
||||
def __init__(self):
|
||||
self.itemModifiedAttributes = None
|
||||
|
||||
def getModifiedItemAttr(self, key):
|
||||
if key in self.itemModifiedAttributes:
|
||||
return self.itemModifiedAttributes[key]
|
||||
@@ -33,6 +36,9 @@ class ItemAttrShortcut(object):
|
||||
|
||||
|
||||
class ChargeAttrShortcut(object):
|
||||
def __init__(self):
|
||||
self.chargeModifiedAttributes = None
|
||||
|
||||
def getModifiedChargeAttr(self, key):
|
||||
if key in self.chargeModifiedAttributes:
|
||||
return self.chargeModifiedAttributes[key]
|
||||
|
||||
@@ -93,6 +93,8 @@ class Character(object):
|
||||
return all0
|
||||
|
||||
def __init__(self, name, defaultLevel=None, initSkills=True):
|
||||
self.ID = None
|
||||
self.apiID = None
|
||||
self.savedName = name
|
||||
self.__owner = None
|
||||
self.defaultLevel = defaultLevel
|
||||
@@ -258,6 +260,7 @@ class Character(object):
|
||||
|
||||
class Skill(HandledItem):
|
||||
def __init__(self, item, level=0, ro=False, learned=True):
|
||||
self.character = None
|
||||
self.__item = item if not isinstance(item, int) else None
|
||||
self.itemID = item.ID if not isinstance(item, int) else item
|
||||
self.__level = level if learned else None
|
||||
|
||||
@@ -24,6 +24,7 @@ class DamagePattern(object):
|
||||
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
|
||||
|
||||
def __init__(self, emAmount=25, thermalAmount=25, kineticAmount=25, explosiveAmount=25):
|
||||
self.name = None
|
||||
self.emAmount = emAmount
|
||||
self.thermalAmount = thermalAmount
|
||||
self.kineticAmount = kineticAmount
|
||||
|
||||
@@ -35,6 +35,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
|
||||
def __init__(self, item):
|
||||
"""Initialize a fighter from the program"""
|
||||
self.owner = None
|
||||
self.__item = item
|
||||
|
||||
if self.isInvalid:
|
||||
|
||||
@@ -46,6 +46,7 @@ class FighterAbility(object):
|
||||
|
||||
def __init__(self, effect):
|
||||
"""Initialize from the program"""
|
||||
self.fighter = None
|
||||
self.__effect = effect
|
||||
self.effectID = effect.ID if effect is not None else None
|
||||
self.active = False
|
||||
|
||||
@@ -58,6 +58,9 @@ class Fit(object):
|
||||
def __init__(self, ship=None, name=""):
|
||||
"""Initialize a fit from the program"""
|
||||
# use @mode.setter's to set __attr and IDs. This will set mode as well
|
||||
self.ID = None
|
||||
self.owner = None
|
||||
self.projectedOnto = None
|
||||
self.ship = ship
|
||||
if self.ship:
|
||||
self.ship.parent = self
|
||||
|
||||
@@ -80,6 +80,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
|
||||
def __init__(self, item):
|
||||
"""Initialize a module from the program"""
|
||||
self.owner = None
|
||||
self.dummySlot = None
|
||||
self.__item = item
|
||||
|
||||
if item is not None and self.isInvalid:
|
||||
|
||||
@@ -25,6 +25,7 @@ class TargetResists(object):
|
||||
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
|
||||
|
||||
def __init__(self, emAmount=0, thermalAmount=0, kineticAmount=0, explosiveAmount=0):
|
||||
self.name = None
|
||||
self.emAmount = emAmount
|
||||
self.thermalAmount = thermalAmount
|
||||
self.kineticAmount = kineticAmount
|
||||
|
||||
Reference in New Issue
Block a user