mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-08 23:50:38 +03:00
Fixed async funcs
This commit is contained in:
parent
3d41a500c9
commit
9512528a77
|
@ -6,10 +6,13 @@ This includes:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from promise import Promise, is_thenable
|
from promise import Promise, is_thenable # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
||||||
def is_thenable(obj):
|
class Promise(object): # type: ignore
|
||||||
|
pass
|
||||||
|
|
||||||
|
def is_thenable(obj): # type: ignore
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +31,7 @@ def maybe_thenable(obj, on_resolve):
|
||||||
returning the same type of object inputed.
|
returning the same type of object inputed.
|
||||||
If the object is not thenable, it should return on_resolve(obj)
|
If the object is not thenable, it should return on_resolve(obj)
|
||||||
"""
|
"""
|
||||||
if isawaitable(obj):
|
if isawaitable(obj) and not isinstance(obj, Promise):
|
||||||
return await_and_execute(obj, on_resolve)
|
return await_and_execute(obj, on_resolve)
|
||||||
|
|
||||||
if is_thenable(obj):
|
if is_thenable(obj):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user