# http://pyrocko.org - GPLv3 # # The Pyrocko Developers, 21st Century # ---|P------/S----------~Lg----------
self._f = f self._parent = None self._cache = {}
if kwargs.get('nocache', False): return self.call_nocache(*x)
if x not in self._cache: if self._parent is not None: self._cache[x] = self._f(self._parent(*x[:-1]), *x[-1]) else: self._cache[x] = self._f(*x[-1])
return self._cache[x]
if self._parent is not None: return self._f(self._parent.call_nocache(*x[:-1]), *x[-1]) else: return self._f(*x[-1])
self._cache.clear()
parent = None self.stages = [] for stage in stages: if not isinstance(stage, Stage): stage = Stage(stage)
stage._parent = parent parent = stage self.stages.append(stage)
for stage in self.stages: stage.clear()
return self.stages[len(x)-1](*x, **kwargs) |