utils.py 文件源码

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

项目:fabric8-analytics-tagger 作者: fabric8-analytics 项目源码 文件源码
def progressbarize(iterable, progress=False):
    """Construct progressbar for loops if progressbar requested, otherwise return directly iterable.

    :param iterable: iterable to use
    :param progress: True if print progressbar
    """
    if progress:
        # The casting to list is due to possibly yielded value that prevents
        # ProgressBar to compute overall ETA
        return progressbar.ProgressBar(widgets=[
            progressbar.Timer(), ', ',
            progressbar.Percentage(), ', ',
            progressbar.SimpleProgress(), ', ',
            progressbar.ETA()
        ])(list(iterable))

    return iterable
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号