示例#1
0
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
示例#2
0
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
示例#3
0
文件: common.py 项目: doug-c/pyEX
 def _wrapper(foo):
     temporal_args['persistent'] = os.path.join(_PYEX_CACHE_FOLDER,
                                                foo.__name__)
     return interval(**temporal_args)(foo)
示例#4
0
文件: timing.py 项目: iexcloud/pyEX
 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)