collector.py 文件源码

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

项目:lydoc 作者: Cecca 项目源码 文件源码
def function_definition(self, ast):
        logging.debug("Found function definition %s", ast.name)
        self.add_position_info(ast)
        # Convert the AST to a simple dict, so that the grako buffer
        # associated with the parseinfo can be released when it is no
        # longer needed. Otherwise, the buffer is kept in memory
        # until the reference to this AST is kept in memory. When
        # dealing with many files this can lead to an excessive
        # memory usage.
        ast = dict(ast)
        ast['type'] = 'function'
        # Strip the comment character from the beginning of the line
        docs = ast['documentation']
        if docs is not None:
            stripped = strip_leading_comments(docs)
            ast['documentation'] = stripped
        self.collected_elements.append(ast)
        return ast
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号