messaging.py 文件源码

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

项目:CEX.IO-Client-Python3.5 作者: cexioltd 项目源码 文件源码
def is_awaitable(obj):
        # There is no single method which can answer in any case, should wait or not - so need to create one
        # for the suspected cases : func, coro, gen-coro, future,
        #                           class with sync __call__, class with async __call__,
        #                           sync method, async method
        if inspect.isawaitable(obj) or inspect.iscoroutinefunction(obj) or inspect.iscoroutine(obj):
            return True
        elif inspect.isgeneratorfunction(obj):
            return True
        elif CallChain.is_user_defined_class(obj):
            if hasattr(obj, '__call__'):
                return CallChain.is_awaitable(obj.__call__)
            return False
        else:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号