utils.py 文件源码

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

项目:py2swagger 作者: Arello-Mobile 项目源码 文件源码
def get_decorators(function):
    # If we have no func_closure, it means we are not wrapping any other functions.
    decorators = []

    try:
        func_closure = six.get_function_closure(function)
    except AttributeError:
        return decorators
    if not func_closure:
        return [function]
    # Otherwise, we want to collect all of the recursive results for every closure we have.
    for closure in func_closure:
        if isinstance(closure.cell_contents, types.FunctionType):
            decorators.extend(get_decorators(closure.cell_contents))
    return [function] + decorators
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号