MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / init

Method init

eos/saveddata/fit.py:102–133  ·  view source on GitHub ↗

Initialize a fit from the database and validate

(self)

Source from the content-addressed store, hash-verified

100
101 @reconstructor
102 def init(self):
103 """Initialize a fit from the database and validate"""
104 self.__ship = None
105 self.__mode = None
106
107 if self.shipID:
108 item = eos.db.getItem(self.shipID)
109 if item is None:
110 pyfalog.error("Item (id: {0}) does not exist", self.shipID)
111 return
112
113 try:
114 try:
115 self.__ship = Ship(item, self)
116 except ValueError:
117 self.__ship = Citadel(item, self)
118 # @todo extra attributes is now useless, however it set to be
119 # the same as ship attributes for ease (so we don't have to
120 # change all instances in source). Remove this at some point
121 self.extraAttributes = self.__ship.itemModifiedAttributes
122 except ValueError:
123 pyfalog.error("Item (id: {0}) is not a Ship", self.shipID)
124 return
125
126 if self.modeID and self.__ship:
127 item = eos.db.getItem(self.modeID)
128 # Don't need to verify if it's a proper item, as validateModeItem assures this
129 self.__mode = self.ship.validateModeItem(item, owner=self)
130 else:
131 self.__mode = self.ship.validateModeItem(None, owner=self)
132
133 self.build()
134
135 def build(self):
136 self.__extraDrains = []

Callers

nothing calls this directly

Calls 5

buildMethod · 0.95
ShipClass · 0.90
CitadelClass · 0.90
getItemMethod · 0.80
validateModeItemMethod · 0.80

Tested by

no test coverage detected