tx.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:deb-python-txaio 作者: openstack 项目源码 文件源码
def gather(self, futures, consume_exceptions=True):
        def completed(res):
            rtn = []
            for (ok, value) in res:
                rtn.append(value)
                if not ok and not consume_exceptions:
                    value.raiseException()
            return rtn

        # XXX if consume_exceptions is False in asyncio.gather(), it will
        # abort on the first raised exception -- should we set
        # fireOnOneErrback=True (if consume_exceptions=False?) -- but then
        # we'll have to wrap the errback() to extract the "real" failure
        # from the FirstError that gets thrown if you set that ...

        dl = DeferredList(list(futures), consumeErrors=consume_exceptions)
        # we unpack the (ok, value) tuples into just a list of values, so
        # that the callback() gets the same value in asyncio and Twisted.
        add_callbacks(dl, completed, None)
        return dl
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号