fypp.py 文件源码

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

项目:fypp 作者: aradi 项目源码 文件源码
def render(self, tree, divert=False, fixposition=False):
        '''Renders a tree.

        Args:
            tree (fypp-tree): Tree to render.
            divert (bool): Whether output will be diverted and sent for further
                processing, so that no line numbering directives and
                postprocessing are needed at this stage. (Default: False)
            fixposition (bool): Whether file name and line position (variables
                _FILE_ and _LINE_) should be kept at their current values or
                should be updated continuously. (Default: False).

        Returns: str: Rendered string.
        '''
        diverted = self._diverted
        self._diverted = divert
        fixedposition = self._fixedposition
        self._fixedposition = fixposition
        output, eval_inds, eval_pos = self._render(tree)
        if not self._diverted and eval_inds:
            self._postprocess_eval_lines(output, eval_inds, eval_pos)
        self._diverted = diverted
        self._fixedposition = fixedposition
        txt = ''.join(output)

        return txt
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号