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

Method prepareDmgData

graphs/data/fitDamageStats/cache/time.py:64–93  ·  view source on GitHub ↗
(self, src, maxTime)

Source from the content-addressed store, hash-verified

62 self._prepareDpsVolleyData(src=src, maxTime=maxTime)
63
64 def prepareDmgData(self, src, maxTime):
65 # Time is none means that time parameter has to be ignored,
66 # we do not need cache for that
67 if maxTime is None:
68 return
69 self._generateInternalForm(src=src, maxTime=maxTime)
70 fitCache = self._data[src.item.ID]
71 # Final cache has been generated already, don't do anything
72 if 'finalDmg' in fitCache:
73 return
74 intCache = fitCache['internalDmg']
75 changesByTime = {}
76 for key, dmgMap in intCache.items():
77 for time in dmgMap:
78 changesByTime.setdefault(time, []).append(key)
79 # Here we convert cache to following format:
80 # {time: {key: damage done by key at this time}}
81 finalCache = fitCache['finalDmg'] = {}
82 timeDmgData = {}
83 for time in sorted(changesByTime):
84 timeDmgData = copy(timeDmgData)
85 for key in changesByTime[time]:
86 keyDmg = intCache[key][time]
87 if key in timeDmgData:
88 timeDmgData[key] = timeDmgData[key] + keyDmg
89 else:
90 timeDmgData[key] = keyDmg
91 finalCache[time] = timeDmgData
92 # We do not need internal cache once we have final
93 del fitCache['internalDmg']
94
95 # Private stuff
96 def _prepareDpsVolleyData(self, src, maxTime):

Callers 1

_prepareTimeCacheMethod · 0.80

Calls 3

_generateInternalFormMethod · 0.95
itemsMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected