bot.py 文件源码

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

项目:PixelCanvasBot 作者: RogerioBlanco 项目源码 文件源码
def wait_time(self, data={'waitSeconds': None}):
        def complete(i, wait):
            return ((100 * (float(i) / float(wait))) * 50) / 100

        if data['waitSeconds'] is not None:
            wait = data['waitSeconds'] + (random.randint(2, 4) / 3.33)
            print(I18n.get('Waiting %s seconds') % str(wait))

            c = i = 0
            while c < 50:
                c = complete(i, wait)
                time.sleep(wait - i if i == int(wait) else 1)
                out.write("[{}]\0\r".format('+' * int(c) + '-' * (50 - int(c))))
                out.flush()
                i += 1
            out.write("\n")
            out.flush()
            return data['waitSeconds']
        return 99999999
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号