def Interval(node, seconds=0, minutes=0, hours=0, days=0, weeks=0, months=0, years=0, maxsize=128): def _interval(node=node): return node() # make new node ret = node._gennode( 'Interval[{}-{}-{}-{}-{}-{}-{}-maxsize:{}'.format( seconds, minutes, hours, days, weeks, months, years, maxsize) + node._name + ')', _interval, [node]) # stash original recompute ret._orig_recompute = ret._recompute # make recompute run on interval ret._recompute = interval(seconds=seconds, minutes=minutes, hours=hours, days=days, weeks=weeks, months=months, years=years, maxsize=maxsize)(ret._recompute) return ret
def Interval(node, seconds=0, minutes=0, hours=0, days=0, weeks=0, months=0, years=0, maxsize=128): def _interval(data): return data # make new node ret = node._gennode( "Interval[{}-{}-{}-{}-{}-{}-{}-maxsize:{}]({})".format( seconds, minutes, hours, days, weeks, months, years, maxsize, node._name), _interval, [node], ) # stash original recompute ret._orig_call = ret._call # make recompute run on interval ret._call = interval( seconds=seconds, minutes=minutes, hours=hours, days=days, weeks=weeks, months=months, years=years, maxsize=maxsize, )(ret._call) return ret
def _wrapper(foo): temporal_args['persistent'] = os.path.join(_PYEX_CACHE_FOLDER, foo.__name__) return interval(**temporal_args)(foo)
def _wrapper(foo): if temporal_args.get("persistent", False): temporal_args["persistent"] = os.path.join( _PYEX_CACHE_FOLDER, foo.__name__ ) return interval(**temporal_args)(foo)