コード例 #1
0
def asyncPipeForever():
    """A source that returns a Deferred infinite generator of items. Loopable.

    Returns
    -------
    _OUTPUT : twisted.internet.defer.Deferred generator of items
    """
    return asyncReturn(forever)
コード例 #2
0
def asyncGetSplits(_INPUT, pieces=None, funcs=None, **kwargs):
    _input = yield _INPUT
    finitize = kwargs.pop('finitize', False)
    dictize = kwargs.pop('dictize', False)
    # asyncDict = partial(maybeDeferred, DotDict)
    # inputs = yield asyncCmap(asyncDict, _input)
    finite = utils.finitize(_input) if finitize and _input else _input
    funcs = funcs or get_async_broadcast_funcs(pieces, **kwargs)
    inputs = imap(DotDict, finite) if finite and dictize else finite

    if inputs:
        result = yield asyncBroadcast(inputs, *funcs)
    else:
        result = yield asyncReturn(funcs)

    returnValue(result)
コード例 #3
0
def asyncParseResult(rules, word, _pass):
    # asyncSubstitute = coopReduce(func, rules, word)
    asyncSubstitute = asyncReduce(partial(maybeDeferred, func), rules, word)
    return asyncReturn(word) if _pass else asyncSubstitute
コード例 #4
0
def asyncParseResult(rules, word, _pass):
    # return asyncReturn(word) if _pass else coopReduce(func, rules, word)
    asyncFunc = partial(maybeDeferred, func)
    return asyncReturn(word) if _pass else asyncReduce(asyncFunc, rules, word)
コード例 #5
0
def asyncParseResult(rules, word, _pass):
    # return asyncReturn(word) if _pass else coopReduce(func, rules, word)
    asyncFunc = partial(maybeDeferred, func)
    return asyncReturn(word) if _pass else asyncReduce(asyncFunc, rules, word)
コード例 #6
0
def asyncGetRateData():
    make_cache_key = utils.cache._memoize_make_cache_key(timeout=utils.timeout)
    cached = utils.cache.get(make_cache_key(get_rate_data))
    return asyncReturn(cached) if cached else deferToThread(get_rate_data)
コード例 #7
0
def asyncParseResult(rules, word, _pass):
    # asyncSubstitute = coopReduce(func, rules, word)
    asyncSubstitute = asyncReduce(partial(maybeDeferred, func), rules, word)
    return asyncReturn(word) if _pass else asyncSubstitute