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

Class FitWarpTimeGraph

graphs/data/fitWarpTime/graph.py:31–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31class FitWarpTimeGraph(FitGraph):
32
33 def __init__(self, *args, **kwargs):
34 super().__init__(*args, **kwargs)
35 self._subspeedCache = SubwarpSpeedCache()
36
37 def _clearInternalCache(self, reason, extraData):
38 if reason in (GraphCacheCleanupReason.fitChanged, GraphCacheCleanupReason.fitRemoved):
39 self._subspeedCache.clearForFit(extraData)
40 elif reason == GraphCacheCleanupReason.graphSwitched:
41 self._subspeedCache.clearAll()
42
43 # UI stuff
44 internalName = 'warpTimeGraph'
45 name = _t('Warp Time')
46 xDefs = [
47 XDef(handle='distance', unit='AU', label=_t('Distance'), mainInput=('distance', 'AU')),
48 XDef(handle='distance', unit='km', label=_t('Distance'), mainInput=('distance', 'km'))]
49 yDefs = [YDef(handle='time', unit='s', label=_t('Warp time'))]
50 inputs = [
51 Input(handle='distance', unit='AU', label=_t('Distance'), iconID=1391, defaultValue=20, defaultRange=(0, 50)),
52 Input(handle='distance', unit='km', label=_t('Distance'), iconID=1391, defaultValue=1000, defaultRange=(150, 5000))]
53 srcExtraCols = ('WarpSpeed', 'WarpDistance')
54
55 # Calculation stuff
56 _normalizers = {
57 ('distance', 'AU'): lambda v, src, tgt: v * AU_METERS,
58 ('distance', 'km'): lambda v, src, tgt: v * 1000
59 }
60 _limiters = {'distance': lambda src, tgt: (0, src.item.maxWarpDistance * AU_METERS)}
61 _getters = {('distance', 'time'): Distance2TimeGetter}
62 _denormalizers = {
63 ('distance', 'AU'): lambda v, src, tgt: v / AU_METERS,
64 ('distance', 'km'): lambda v, src, tgt: v / 1000}

Callers

nothing calls this directly

Calls 4

XDefClass · 0.90
YDefClass · 0.90
InputClass · 0.90
_tFunction · 0.50

Tested by

no test coverage detected