tree.py 文件源码

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

项目:Codado 作者: corydodt 项目源码 文件源码
def openAPIDoc(**kwargs):
    """
    Update a function's docstring to include the OpenAPI Yaml generated by running the openAPIGraph object
    """
    s = yaml.dump(kwargs, default_flow_style=False)
    def deco(routeHandler):
        # Wrap routeHandler, retaining name and __doc__, then edit __doc__.

        # The only reason we need to do this is so we can be certain
        # that __doc__ will be modifiable. partial() objects have
        # a modifiable __doc__, but native function objects do not.
        ret = functools.wraps(routeHandler)(routeHandler)
        if not ret.__doc__:
            ret.__doc__ = ''
        ret.__doc__ = cleandoc(ret.__doc__) + '\n---\n' + s
        return ret
    return deco
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号