stitch_utils.py 文件源码

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

项目:Stitch 作者: nathanlopez 项目源码 文件源码
def increment(self, inc_track=1024, inc_prog=1024, file_inc=True):
        self.tracker  += inc_track
        self.progress += inc_prog
        if file_inc:
            while self.progress >= self.percent and self.tracker < self.size:
                self.progress = self.progress - self.percent
                self.tick += 1
                space = self.bar_size - self.tick
                total_percentage = 2 * self.tick
                p_output = "[{}{}] %{}".format(p_bar * self.tick, ' ' * space, total_percentage)
                sys.stdout.write(p_output)
                sys.stdout.flush()
                sys.stdout.write("\b" * (len(p_output)))
        else:
            self.tick = int((float(self.progress)/float(self.size)) * float(self.bar_size))
            space = self.bar_size - self.tick
            total_percentage = 2 * self.tick
            p_output = "[{}{}] %{}".format(p_bar * self.tick, ' ' * space, total_percentage)
            sys.stdout.write(p_output)
            sys.stdout.flush()
            sys.stdout.write("\b" * (len(p_output)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号