本文整理汇总了Python中backports_abc.isawaitable方法的典型用法代码示例。如果您正苦于以下问题:Python backports_abc.isawaitable方法的具体用法?Python backports_abc.isawaitable怎么用?Python backports_abc.isawaitable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backports_abc
的用法示例。
在下文中一共展示了backports_abc.isawaitable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_yielded
# 需要导入模块: import backports_abc [as 别名]
# 或者: from backports_abc import isawaitable [as 别名]
def convert_yielded(yielded):
"""Convert a yielded object into a `.Future`.
The default implementation accepts lists, dictionaries, and Futures.
If the `~functools.singledispatch` library is available, this function
may be extended to support additional types. For example::
@convert_yielded.register(asyncio.Future)
def _(asyncio_future):
return tornado.platform.asyncio.to_tornado_future(asyncio_future)
.. versionadded:: 4.1
"""
# Lists and dicts containing YieldPoints were handled earlier.
if isinstance(yielded, (list, dict)):
return multi(yielded)
elif is_future(yielded):
return yielded
elif isawaitable(yielded):
return _wrap_awaitable(yielded)
else:
raise BadYieldError("yielded unknown object %r" % (yielded,))
示例2: isawaitable
# 需要导入模块: import backports_abc [as 别名]
# 或者: from backports_abc import isawaitable [as 别名]
def isawaitable(x):
return False
示例3: isawaitable
# 需要导入模块: import backports_abc [as 别名]
# 或者: from backports_abc import isawaitable [as 别名]
def isawaitable(x): # type: ignore
return False