Display progress bar
    sources: https://gist.github.com/vladignatyev/06860ec2040cb497f0f3
427979
def progress(count, total, suffix=''):
    '''
    
    '''
    bar_len = 60
    filled_len = int(round(bar_len * count / float(total)))
    percents = round(100.0 * count / float(total), 1)
    bar = '=' * filled_len + '-' * (bar_len - filled_len)
    sys.stdout.write('[%s] %s%s %s\r' % (bar, percents, '%', suffix))
    sys.stdout.flush()
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
153780
def update_progress(cls, progress, starttime):
        
        width, _height = click.get_terminal_size()
        if not width:
            return

        duration = datetime.utcnow() - starttime
        hours, remainder = divmod(duration.seconds, 3600)
        minutes, seconds = divmod(remainder, 60)

        size = int(width * .6)
        status = ""
        if isinstance(progress, int):
            progress = float(progress)
        if not isinstance(progress, float):
            progress = 0
            status = 'error: progress var must be float\n'
            cls.echo(type(progress))
        if progress < 0:
            progress = 0
            status = 'Halt...\n'
        if progress >= 1:
            progress = 1
            # status = 'Done...\n'
        block = int(round(size * progress))
        text = ('\rProgress: [{0}] {1:.2%} {2} {3:0>2}:{4:0>2}:{5:0>2}  '
                ''.format('#' * block + '-' * (size - block), progress,
                          status, hours, minutes, seconds))
        sys.stdout.write(text)
        sys.stdout.flush()
174171
def show_progress(self):
        """'"""
        if self.in_progress_hanging:
            sys.stdout.write('.')
            sys.stdout.flush()
1156322
def _update_progress_bar(self):
        # type: (Downloader) -> None
        
        blobxfer.operations.progress.update_progress_bar(
            self._general_options,
            'download',
            self._download_start_time,
            self._download_total,
            self._download_sofar,
            self._download_bytes_total,
            self._download_bytes_sofar,
        )
1336086
def walk_dir_progress(path, maxdircnt=5000, file=sys.stdout):
    
    p = ProgressBar(
        'Walking {}'.format(C(path, 'cyan')),
        bars=Bars.numbers_blue.with_wrapper(('(', ')')),
        show_time=True,
        file=file,
    )
    rootcnt = 0
    print('\nStarting progress bar...')
    p.start()

    for root, dirs, files in os.walk(path):
        rootcnt += 1
        if rootcnt % 100 == 0:
            p.update(
                percent=min((rootcnt / maxdircnt) * 100, 100),
                text='Walking {}...'.format(
                    C(os.path.split(root)[-1], 'cyan'),
                )
            )

        if rootcnt > maxdircnt:
            # Stop is called because we are printing before the
            # AnimatedProgress is finished running.
            p.stop()
            print(
                '\nFinished walking {} directories.'.format(
                    C(maxdircnt, 'blue', style='bright')
                ),
                file=file,
            )
            break
    else:
        # AnimatedProgress still running, `stop` it before printing.
        p.stop()
        print_err(
            '\nNever made it to {} directories ({}).'.format(
                C(maxdircnt, 'blue', style='bright'),
                C(rootcnt, 'red', style='bright'),
            )
        )
    print('\nFinished with progress bar.')
    return 0
633519
def finish(self):
        
        pct = floor(round(self.progress/self.size, 2)*100)
        pr = floor(pct*.33)
        bar = "".join([" " for x in range(pr-1)] + ["↦"])
        subprogress = self.format_parent_bar() if self.parent_bar else ""
        fin = "Loading{} ={}{} ({}%)".format(subprogress, bar, "ӿ", pct)
        print(fin.ljust(len(fin)+5), end="\r")
        time.sleep(0.10)
        print("\033[K\033[1A")
        self.progress = 0
956119
def make_timebar(progress=0, duration=0):
    

    duration_string = api_music.duration_to_string(duration)
    if duration <= 0:
        return "---"

    time_counts = int(round((progress / duration) * TIMEBAR_LENGTH))
    if time_counts > TIMEBAR_LENGTH:
        time_counts = TIMEBAR_LENGTH

    if duration > 0:
        bar = "│" + (TIMEBAR_PCHAR * time_counts) + (TIMEBAR_ECHAR * (TIMEBAR_LENGTH - time_counts)) + "│"
        time_bar = "{} {}".format(bar, duration_string)
    else:
        time_bar = duration_string

    return time_bar
1230322
def _finish_progress(self):
        

        if self._show_progressbar:
            if self._progressbar is None:
                self._initialize_progressbar()
            if self._progressbar is not None:
                self._progressbar.finish()

        if self._progress_callback is not None:
            self._progress_callback(100.0)
91953
def progressbar(length, label):
    
    return click.progressbar(length=length, label=label, show_pos=True)
925195
function updateStatusBarVisibility() {
    const cntnr = d3.select(model.container);
    if (model.statusBarVisible) {
      cntnr
        .select('.status-bar-container')
        .style('width', function updateWidth() {
          return this.dataset.width;
        });
      cntnr.select('.show-button').classed(style.hidden, true);
      cntnr.select('.hide-button').classed(style.hidden, false);
      cntnr.select('.status-bar-text').classed(style.hidden, false);
    } else {
      cntnr.select('.status-bar-container').style('width', '20px');
      cntnr.select('.show-button').classed(style.hidden, false);
      cntnr.select('.hide-button').classed(style.hidden, true);
      cntnr.select('.status-bar-text').classed(style.hidden, true);
    }
  }
984510
def eta_bar(msg, max_value):
    

    widgets = [
        "{msg}:".format(msg=msg),
        progressbar.Bar(), ' ', progressbar.AdaptiveETA(),
    ]

    return progressbar.ProgressBar(widgets=widgets, max_value=max_value)
1360745
def _ProgressMeterUpdate(bar, value, text_elem, *args):
    '''
    
    '''
    global _my_windows
    if bar == None: return False
    if bar.BarExpired: return False
    message, w, h = ConvertArgsToSingleString(*args)
    text_elem.Update(message)
    # bar.TextToDisplay = message
    bar.CurrentValue = value
    rc = bar.UpdateBar(value)
    if value >= bar.MaxValue or not rc:
        bar.BarExpired = True
        bar.ParentForm._Close()
        if rc:  # if update was OK but bar expired, decrement num windows
            _my_windows.Decrement()
    if bar.ParentForm.RootNeedsDestroying:
        try:
            bar.ParentForm.TKroot.destroy()
            # there is a bug with progress meters not decrementing the number of windows
            # correctly when the X is used to close the window
            # uncommenting this line fixes that problem, but causes a double-decrement when
            # the cancel button is used... damned if you do, damned if you don't, so I'm choosing
            # don't, as in don't decrement too many times. It's OK now to have a mismatch in
            # number of windows because of the "hidden" master window. This ensures all windows
            # will be toplevel.  Sorry about the bug, but the user never sees any problems as a result
            # _my_windows.Decrement()
        except:
            pass
        bar.ParentForm.RootNeedsDestroying = False
        bar.ParentForm.__del__()
        return False

    return rc
25865
function ProgressBar(progress) {
  // Make it 50 characters length
  progress = Math.min(100, progress)
  var units = Math.round(progress / 2)
  return chalk.dim('[') + chalk.blue('=').repeat(units) + ' '.repeat(50 - units) + chalk.dim('] ') + chalk.yellow(progress + '%')
}
377274
def get_progressbar(self, total, **options):
        
        progressbar = ColoredProgressBar(total)
        progressbar.steps_label = 'Commit'
        progressbar.elements += ['eta', 'time']
        return progressbar
683719
function (e, data) {
                if (data.context) {
                    var progress = Math.floor(data.loaded / data.total * 100);
                    data.context.find('.progress')
                        .attr('aria-valuenow', progress)
                        .find('.bar').css(
                            'width',
                            progress + '%'
                        );
                }
            }
567515
def progress(self, *msg):
        
        label = colors.purple("Progress")
        self._msg(label, *msg)