Allow utils.maybe_coroutine to take any arguments.
This commit is contained in:
parent
8e654bd52a
commit
dcf826c09b
@ -261,11 +261,11 @@ def to_json(obj):
|
|||||||
return json.dumps(obj, separators=(',', ':'), ensure_ascii=True)
|
return json.dumps(obj, separators=(',', ':'), ensure_ascii=True)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def maybe_coroutine(f, e):
|
def maybe_coroutine(f, *args, **kwargs):
|
||||||
if asyncio.iscoroutinefunction(f):
|
if asyncio.iscoroutinefunction(f):
|
||||||
return (yield from f(e))
|
return (yield from f(*args, **kwargs))
|
||||||
else:
|
else:
|
||||||
return f(e)
|
return f(*args, **kwargs)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_all(gen):
|
def async_all(gen):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user