當前位置: 首頁>>代碼示例>>Python>>正文


Python backports_abc.isawaitable方法代碼示例

本文整理匯總了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,)) 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:25,代碼來源:gen.py

示例2: isawaitable

# 需要導入模塊: import backports_abc [as 別名]
# 或者: from backports_abc import isawaitable [as 別名]
def isawaitable(x):
        return False 
開發者ID:DirceuSilvaLabs,項目名稱:noc-orchestrator,代碼行數:4,代碼來源:gen.py

示例3: isawaitable

# 需要導入模塊: import backports_abc [as 別名]
# 或者: from backports_abc import isawaitable [as 別名]
def isawaitable(x):  # type: ignore
        return False 
開發者ID:Knight-ZXW,項目名稱:aweasome_learning,代碼行數:4,代碼來源:gen.py


注:本文中的backports_abc.isawaitable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。