def wrap(f): if iscoroutinefunction is not None and iscoroutinefunction(f): r = AsyncRetrying(*dargs, **dkw) elif (tornado and hasattr(tornado.gen, "is_coroutine_function") and tornado.gen.is_coroutine_function(f)): r = TornadoRetrying(*dargs, **dkw) else: r = Retrying(*dargs, **dkw) return r.wraps(f)
def wrap(f): if asyncio and asyncio.iscoroutinefunction(f): r = AsyncRetrying(*dargs, **dkw) elif tornado and hasattr(tornado.gen, 'is_coroutine_function') \ and tornado.gen.is_coroutine_function(f): r = TornadoRetrying(*dargs, **dkw) else: r = Retrying(*dargs, **dkw) return r.wraps(f)
def wrap(f): if isinstance(f, retry_base): warnings.warn( ("Got retry_base instance ({cls}) as callable argument, " + "this will probably hang indefinitely (did you mean " + "retry={cls}(...)?)").format(cls=f.__class__.__name__)) if iscoroutinefunction is not None and iscoroutinefunction(f): r = AsyncRetrying(*dargs, **dkw) elif (tornado and hasattr(tornado.gen, "is_coroutine_function") and tornado.gen.is_coroutine_function(f)): r = TornadoRetrying(*dargs, **dkw) else: r = Retrying(*dargs, **dkw) return r.wraps(f)