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

Method makeCheapMapCb

service/price.py:212–225  ·  view source on GitHub ↗
(requests)

Source from the content-addressed store, hash-verified

210 itemsToFetch = {i for i in chain(replacementsAll.keys(), *replacementsAll.values())}
211
212 def makeCheapMapCb(requests):
213 # Decide what we are going to replace
214 replacementsCheaper = {} # Items which should be replaced
215 for replacee, replacers in replacementsAll.items():
216 replacer = min(replacers, key=lambda i: i.price.price or math.inf)
217 if (replacer.price.price or math.inf) < (replacee.price.price or math.inf):
218 replacementsCheaper[replacee] = replacer
219 try:
220 callback(replacementsCheaper)
221 except (KeyboardInterrupt, SystemExit):
222 raise
223 except Exception as e:
224 pyfalog.critical("Execution of callback from findCheaperReplacements failed.")
225 pyfalog.critical(e)
226
227 # Prices older than 2 hours have to be refetched
228 validityOverride = 2 * 60 * 60

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected