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

Method getRange

graphs/data/fitRemoteReps/getter.py:112–164  ·  view source on GitHub ↗
(self, xRange, miscParams, src, tgt)

Source from the content-addressed store, hash-verified

110class XTimeMixin(PointGetter):
111
112 def getRange(self, xRange, miscParams, src, tgt):
113 xs = []
114 ys = []
115 minTime, maxTime = xRange
116 # Prepare time cache and various shared data
117 self._prepareTimeCache(src=src, ancReload=miscParams['ancReload'], maxTime=maxTime)
118 timeCache = self._getTimeCacheData(src=src, ancReload=miscParams['ancReload'])
119 applicationMap = getApplicationPerKey(src=src, distance=miscParams['distance'])
120 # Custom iteration for time graph to show all data points
121 currentRepAmount = None
122 currentTime = None
123 for currentTime in sorted(timeCache):
124 prevRepAmount = currentRepAmount
125 currentRepAmountData = timeCache[currentTime]
126 currentRepAmount = applyReps(rrMap=currentRepAmountData, applicationMap=applicationMap)
127 if currentTime < minTime:
128 continue
129 # First set of data points
130 if not xs:
131 # Start at exactly requested time, at last known value
132 initialRepAmount = prevRepAmount or 0
133 xs.append(minTime)
134 ys.append(initialRepAmount)
135 # If current time is bigger then starting, extend plot to that time with old value
136 if currentTime > minTime:
137 xs.append(currentTime)
138 ys.append(initialRepAmount)
139 # If new value is different, extend it with new point to the new value
140 if currentRepAmount != prevRepAmount:
141 xs.append(currentTime)
142 ys.append(currentRepAmount)
143 continue
144 # Last data point
145 if currentTime >= maxTime:
146 xs.append(maxTime)
147 ys.append(prevRepAmount)
148 break
149 # Anything in-between
150 if currentRepAmount != prevRepAmount:
151 if prevRepAmount is not None:
152 xs.append(currentTime)
153 ys.append(prevRepAmount)
154 xs.append(currentTime)
155 ys.append(currentRepAmount)
156 # Special case - there are no remote reppers
157 if currentRepAmount is None and currentTime is None:
158 xs.append(minTime)
159 ys.append(0)
160 # Make sure that last data point is always at max time
161 if maxTime > (currentTime or 0):
162 xs.append(maxTime)
163 ys.append(currentRepAmount or 0)
164 return xs, ys
165
166 def getPoint(self, x, miscParams, src, tgt):
167 time = x

Callers

nothing calls this directly

Calls 5

applyRepsFunction · 0.85
getApplicationPerKeyFunction · 0.70
_prepareTimeCacheMethod · 0.45
_getTimeCacheDataMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected