async.py 文件源码

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

项目:poloniex-api 作者: absortium 项目源码 文件源码
def trollbox_wrapper(handler):
    async def decorator(data):
        if len(data) != 5:
            return

        type_ = data[0]
        message_id = data[1]
        username = data[2]
        text = data[3]
        reputation = data[4]

        kwargs = {
            "id": message_id,
            "username": username,
            "type": type_,
            "text": text,
            "reputation": reputation
        }

        if inspect.isgeneratorfunction(handler):
            await handler(**kwargs)
        else:
            handler(**kwargs)

    return decorator
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号