MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / _resolve_module

Function _resolve_module

service/port/xml.py:118–154  ·  view source on GitHub ↗
(hardware, sMkt, b_localized)

Source from the content-addressed store, hash-verified

116
117
118def _resolve_module(hardware, sMkt, b_localized):
119 # type: (xml.dom.minidom.Element, service.market.Market, bool) -> eos.saveddata.module.Module
120 moduleName = hardware.getAttribute("base_type") or hardware.getAttribute("type")
121 emergency = None
122 if b_localized:
123 try:
124 # expect an official name, emergency cache
125 moduleName, emergency = _extract_match(moduleName)
126 except ExtractingError:
127 pass
128
129 item = None
130 limit = 2
131 while True:
132 must_retry = False
133 try:
134 item = sMkt.getItem(moduleName, eager="group.category")
135 except (KeyboardInterrupt, SystemExit):
136 raise
137 except Exception as e:
138 pyfalog.warning("Caught exception on _resolve_module")
139 pyfalog.error(e)
140 limit -= 1
141 if limit == 0:
142 break
143 moduleName = emergency
144 must_retry = True
145 if not must_retry:
146 break
147
148 mutaplasmidName = hardware.getAttribute("mutaplasmid")
149 mutaplasmidItem = fetchItem(mutaplasmidName) if mutaplasmidName else None
150
151 mutatedAttrsText = hardware.getAttribute("mutated_attrs")
152 mutatedAttrs = parseMutantAttrs(mutatedAttrsText) if mutatedAttrsText else None
153
154 return item, mutaplasmidItem, mutatedAttrs
155
156
157def importXml(text, progress):

Callers 1

importXmlFunction · 0.85

Calls 5

fetchItemFunction · 0.90
parseMutantAttrsFunction · 0.90
_extract_matchFunction · 0.85
getAttributeMethod · 0.80
getItemMethod · 0.80

Tested by

no test coverage detected