Ejemplo n.º 1
0
def async_wrapper(wrapped):
    if is_coroutine_function(wrapped):
        return coroutine_wrapper
    elif is_generator_function(wrapped):
        if is_asyncio_coroutine(wrapped):
            return awaitable_generator_wrapper
        else:
            return generator_wrapper
Ejemplo n.º 2
0
def async_proxy(wrapped):
    if is_coroutine_function(wrapped):
        return CoroutineProxy
    elif is_generator_function(wrapped):
        if is_asyncio_coroutine(wrapped):
            return AwaitableGeneratorProxy
        else:
            return GeneratorProxy
Ejemplo n.º 3
0
def _nr_wrapper_convert_exception_to_response_(wrapped, instance, args,
                                               kwargs):
    def _bind_params(original_middleware, *args, **kwargs):
        return original_middleware

    original_middleware = _bind_params(*args, **kwargs)
    converted_middleware = wrapped(*args, **kwargs)
    name = callable_name(original_middleware)

    if is_coroutine_function(converted_middleware) or is_asyncio_coroutine(
            converted_middleware):
        return _nr_wrap_converted_middleware_async_(converted_middleware, name)
    return _nr_wrap_converted_middleware_(converted_middleware, name)
Ejemplo n.º 4
0
def is_coroutine(fn):
    return is_coroutine_callable(fn) or is_asyncio_coroutine(fn)
def is_coroutine(fn):
    return is_coroutine_function(fn) or is_asyncio_coroutine(fn)