python类Counter()的实例源码

base.py 文件源码 项目:django-geoware 作者: un33k 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        self.dld = FileDownloader()
        self.dld.stage(self.cmd_name)

        load_continents()
        load_oceans()
        load_currencies()
        load_languages()

        self.widgets = [
            MemoryUsage(),
            progressbar.ETA(),
            ' |Processed: ',
            progressbar.Counter(),
            ' |Done: ',
            progressbar.Percentage(),
            progressbar.Bar(),
        ]
        return super().__init__(*args, **kwargs)
__init__.py 文件源码 项目:httphose 作者: HarryR 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _setup_progress(self, options):
        if options.progress:
            if self.beanstalk:
                # With Beanstalk C&C we don't know how many...
                self.progress = progressbar.ProgressBar(
                    redirect_stdout=True,
                    redirect_stderr=True,
                    widgets=[
                        'Total: ',
                        progressbar.Counter(),
                        ', ',
                        progressbar.Timer()
                    ])
            else:
                self.progress = progressbar.ProgressBar(
                    redirect_stdout=True,
                    redirect_stderr=True,
                    widgets=[
                        progressbar.Percentage(),
                        progressbar.Bar(),
                        ' (', progressbar.ETA(), ') ',
                    ])
        else:
            self.progress = None
model.py 文件源码 项目:latplan 作者: guicho271828 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def bar_update(self, epoch, logs):
        ologs = {}
        for k in self.custom_log_functions:
            ologs[k] = self.custom_log_functions[k]()
        for k in logs:
            if len(k) > 5:
                ologs[k[-5:]] = logs[k]
            else:
                ologs[k] = logs[k]

        if not hasattr(self,'bar'):
            import progressbar
            widgets = [
                progressbar.Timer(format='%(elapsed)s'),
                ' ', progressbar.Counter(), 
                progressbar.Bar(),
                progressbar.AbsoluteETA(format='%(eta)s'), ' ',
            ]
            keys = []
            for k in ologs:
                keys.append(k)
            keys.sort()
            for k in keys:
                widgets.append(progressbar.DynamicMessage(k))
                widgets.append(' ')
            self.bar = progressbar.ProgressBar(max_value=self.max_epoch, widgets=widgets)
        self.bar.update(epoch+1, **ologs)
misc_utils.py 文件源码 项目:tensorflow-infogan 作者: JonathanRaiman 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def create_progress_bar(message):
    widgets = [
        message,
        progressbar.Counter(),
        ' ',
        progressbar.Percentage(),
        ' ',
        progressbar.Bar(),
        progressbar.AdaptiveETA()
    ]
    pbar = progressbar.ProgressBar(widgets=widgets)
    return pbar
progress.py 文件源码 项目:nway 作者: JohannesBuchner 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def bar(ndigits=3, **kwargs):
    if progressbar.__version__ > '3':
        counterfmt = '%(value)'+str(ndigits)+'d'
    else:
        counterfmt = '%'+str(ndigits)+'d'

    pbar = IncrementingProgressBar(widgets=[
        progressbar.Percentage(), '|', progressbar.Counter(counterfmt),
        progressbar.Bar(), progressbar.ETA()], **kwargs)
    return pbar


问题


面经


文章

微信
公众号

扫码关注公众号