Demonstrate progress bar.
323663
def demo():
    """"""
    from time import sleep
    maxProgress = 1000
    with ProgressBar(max=maxProgress) as progressbar:
        for i in range(-100, maxProgress):
            sleep(0.01)
            progressbar.update(i)
    progressbar2 = ProgressBar(max=maxProgress)
    for s in progressbar2.iterate(range(maxProgress)):
        sleep(0.01)
    for s in progressbar2.iterate(range(maxProgress), format='iteration %d'):
        sleep(0.01)
440723
private function startProgressBar()
    {
        $this->output->newLine(1);
        $this->bar = $this->helper->barSetup($this->output->createProgressBar(5));
        $this->bar->start();
    }
271837
def updateProgressBar(self, *args, **kwargs):
        '''
         
        '''
        value = kwargs.get('progress')
        pb = self.progress_bar
        if value is None:
            return
        if value < 0:
            pb.Pulse()
        else:
            value = min(int(value), pb.GetRange())
            if pb.GetValue() != value:
                # Windows 7 progress bar animation hack
                # http://stackoverflow.com/questions/5332616/disabling-net-progressbar-animation-when-changing-value
                if self.buildSpec['disable_progress_bar_animation'] \
                        and sys.platform.startswith("win"):
                    if pb.GetRange() == value:
                        pb.SetValue(value)
                        pb.SetValue(value - 1)
                    else:
                        pb.SetValue(value + 1)
                pb.SetValue(value)
583975
def build_progress_message(total=None,
                           running=None,
                           finished=None,
                           failed=None,
                           cached=None):
    """"""
    progress_message = {}
    if total:
        progress_message['total'] = total
    if running:
        progress_message['running'] = running
    if finished:
        progress_message['finished'] = finished
    if failed:
        progress_message['failed'] = failed
    if cached:
        progress_message['cached'] = cached
    return progress_message
156925
def _initialize_progress_bar(self):
        """"""

        widgets = ['Download: ', Percentage(), ' ', Bar(),
                   ' ', AdaptiveETA(), ' ', FileTransferSpeed()]

        self._downloadProgressBar = ProgressBar(
            widgets=widgets, max_value=self._imageCount).start()
514556
def _get_progress_bar(self, progress_bar_type):
        """"""
        if tqdm is None:
            if progress_bar_type is not None:
                warnings.warn(_NO_TQDM_ERROR, UserWarning, stacklevel=3)
            return None

        description = "Downloading"
        unit = "rows"

        try:
            if progress_bar_type == "tqdm":
                return tqdm.tqdm(desc=description, total=self.total_rows, unit=unit)
            elif progress_bar_type == "tqdm_notebook":
                return tqdm.tqdm_notebook(
                    desc=description, total=self.total_rows, unit=unit
                )
            elif progress_bar_type == "tqdm_gui":
                return tqdm.tqdm_gui(desc=description, total=self.total_rows, unit=unit)
        except (KeyError, TypeError):
            # Protect ourselves from any tqdm errors. In case of
            # unexpected tqdm behavior, just fall back to showing
            # no progress bar.
            warnings.warn(_NO_TQDM_ERROR, UserWarning, stacklevel=3)
        return None
454539
def cli_progress(addr, offset, size):
    """"""
    width = 25
    done = offset * width // size
    print("\r0x{:08x} {:7d} [{}{}] {:3d}% "
          .format(addr, size, '=' * done, ' ' * (width - done),
                  offset * 100 // size), end="")
    try:
        sys.stdout.flush()
    except OSError:
        pass # Ignore Windows CLI "WinError 87" on Python 3.6
    if offset == size:
        print("")
830087
def _progress_bar(self, width, percent, left="", right="", fill="|"):
        
        text = left + (width - len(left) - len(right)) * " " + right
        cutoff = int(round(percent * width))
        text = text[:cutoff].replace(" ", fill) + text[cutoff:]
        low_cutoff = int(round(0.7 * width))
        med_cutoff = int(round(0.9 * width))
        if percent < 0.7:
            yield 2, text[:cutoff]
            yield 0, text[cutoff:]
        elif percent < 0.9:
            yield 2, text[:low_cutoff]
            yield 3, text[low_cutoff:cutoff]
            yield 0, text[cutoff:]
        else:
            yield 2, text[:low_cutoff]
            yield 3, text[low_cutoff:med_cutoff]
            yield 4, text[med_cutoff:cutoff]
            yield 0, text[cutoff:]
993762
public void showValidationInProgress() {
        validationIcon.setValue(null);
        validationIcon.addStyleName("show-status-label");
        validationIcon.setStyleName(SPUIStyleDefinitions.TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE);
    }
1361800
function showPreset(name, pos){
    console.log(_colors.magenta('Preset: ' + name));

    // create a new progress bar with preset
    var bar = new _progress.Bar({
	    align: pos
    }, _progress.Presets[name] || _progress.Presets.legacy);
    bar.start(200, 0);

    // random value 1..200
    bar.update(Math.floor((Math.random() * 200) + 1));
    bar.stop();
    console.log('');
}
582658
def progress_bar(name, maxval, prefix='Converting'):
    
    widgets = ['{} {}: '.format(prefix, name), Percentage(), ' ',
               Bar(marker='=', left='[', right=']'), ' ', ETA()]
    bar = ProgressBar(widgets=widgets, max_value=maxval, fd=sys.stdout).start()
    try:
        yield bar
    finally:
        bar.update(maxval)
        bar.finish()
138659
def progressed_bar(count, total=100, status=None, suffix=None, bar_len=10):
    """"""
    status = status or ''
    suffix = suffix or '%'
    assert isinstance(count, int)
    count_normalized = count if count <= total else total
    filled_len = int(round(bar_len * count_normalized / float(total)))
    percents = 100.0 * count / float(total)
    color = '#5cb85c'
    if percents < 30.0:
        color = '#d9534f'
    if percents < 70.0:
        color = '#f0ad4e'
    text_color = colors.fg(color)
    bar_color = text_color + colors.bg(color)
    nc_color = colors.dark_gray
    progressbar = (colors.bg('#428bca') | status) if status else ''
    progressbar += (bar_color | ('█' * filled_len))
    progressbar += (nc_color | ('█' * (bar_len - filled_len)))
    progressbar += (text_color | (str(count) + suffix))
    return progressbar
988861
def show(self):
        """"""

        if len(self.text) > self.textwidth:
            label = self.text[0:self.textwidth]
        else:
            label = self.text.rjust(self.textwidth)

        terminalSize = getTerminalSize()
        if terminalSize is None:
            terminalSize = 80
        else:
            terminalSize = terminalSize[1]

        barWidth = terminalSize - self.textwidth - 10

        if self.value is None or self.value < 0:
            pattern = self.twiddle_sequence[
                self.twiddle % len(self.twiddle_sequence)]
            self.twiddle += 1
            barSymbols = (pattern * int(math.ceil(barWidth/3.0)))[0:barWidth]
            progressFractionText = '   . %'
        else:
            progressFraction = float(self.value) / self.max

            nBlocksFrac, nBlocksInt = math.modf(
                max(0.0, min(1.0, progressFraction)) * barWidth)
            nBlocksInt = int(nBlocksInt)

            partialBlock = self.sequence[
                int(math.floor(nBlocksFrac * len(self.sequence)))]

            nBlanks = barWidth - nBlocksInt - 1
            barSymbols = (self.sequence[-1] * nBlocksInt) + partialBlock + \
                (self.sequence[0] * nBlanks)
            barSymbols = barSymbols[:barWidth]
            progressFractionText = ('%.1f%%' % (100*progressFraction)).rjust(6)

        print >>self.fid, '\r\x1B[1m' + label + '\x1B[0m [' + barSymbols + \
            ']' + progressFractionText,
        self.fid.flush()
        self.linefed = False
1368891
def _setup_bar(self):
        
        bar = u""
        items_cnt = len(PROGRESS_BAR_ITEMS)
        bar_val = float(self._time_left) / self._section_time * self.num_progress_bars
        while bar_val > 0:
            selector = int(bar_val * items_cnt)
            selector = min(selector, items_cnt - 1)
            bar += PROGRESS_BAR_ITEMS[selector]
            bar_val -= 1

        bar = bar.ljust(self.num_progress_bars)
        return bar
300229
def log_progress(sequence, every=None, size=None, name='Items'):
    """"""
    from ipywidgets import IntProgress, HTML, VBox
    from IPython.display import display

    is_iterator = False
    if size is None:
        try:
            size = len(sequence)
        except TypeError:
            is_iterator = True
    if size is not None:
        if every is None:
            if size <= 200:
                every = 1
            else:
                every = int(size / 200)     # every 0.5%
    else:
        assert every is not None, 'sequence is iterator, set every'

    if is_iterator:
        progress = IntProgress(min=0, max=1, value=1)
        progress.bar_style = 'info'
    else:
        progress = IntProgress(min=0, max=size, value=0)
    label = HTML()
    box = VBox(children=[label, progress])
    display(box)

    index = 0
    try:
        for index, record in enumerate(sequence, 1):
            if index == 1 or index % every == 0:
                if is_iterator:
                    label.value = '{name}: {index} / ?'.format(
                        name=name,
                        index=index
                    )
                else:
                    progress.value = index
                    label.value = u'{name}: {index} / {size}'.format(
                        name=name,
                        index=index,
                        size=size
                    )
            yield record
    except Exception as e:
        progress.bar_style = 'danger'
        raise
    else:
        progress.bar_style = 'success'
        progress.value = index
        label.value = "{name}: {index}".format(
            name=name,
            index=str(index or '?')
        )
305433
private void obtainShowProgress() {
        boolean showProgress = ThemeUtil.getBoolean(this, R.attr.showProgress, true);
        showProgress(showProgress);
    }
1278436
def format_bar(self):
        
        pct = floor(round(self.progress/self.size, 2)*100)
        pr = floor(pct*.33)
        bar = "".join(
            ["‒" for x in range(pr)] + ["↦"] +
            [" " for o in range(self._barsize-pr-1)])
        subprogress = self.format_parent_bar() if self.parent_bar else ""
        message = "Loading{} ={}{} ({}%)".format(subprogress, bar, "☉", pct)
        return message.ljust(len(message)+5)