(hardware, sMkt, b_localized)
| 116 | |
| 117 | |
| 118 | def _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 | |
| 157 | def importXml(text, progress): |
no test coverage detected