command_group.py 文件源码

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

项目:tetre 作者: aoldoni 项目源码 文件源码
def gen_group_image(self, token, depth=1):
        """Generates the images based on the node that represents this group.

        Args:
            token: The Treenode node.
            depth: integer 1 by default, as we are only interested in the first level.

        Returns:
            A string with the image path.
        """
        e = Digraph(self.argv.tetre_word, format=GroupImageNameGenerator.file_extension)
        e.attr('node', shape='box')

        current_id = self.current_token_id
        e.node(str(current_id), token.pos_)

        self.group_to_graph_recursive_with_depth(token, current_id, e, depth)

        name_generator = GroupImageNameGenerator(self.base_image_name, self.argv.tetre_word, str(self.current_group_id))
        e.render(name_generator.get_render_path())

        self.current_group_id += 1

        return name_generator.get_base_path_with_extension()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号