Python progressbar.AnimatedMarker() Examples

The following are 4 code examples of progressbar.AnimatedMarker(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module progressbar , or try the search function .
Example #1
Source File: _windows.py    From microk8s with Apache License 2.0 6 votes vote down vote up
def _init_progress_bar(total_length, destination, message=None):
    if not message:
        message = "Downloading {!r}".format(os.path.basename(destination))

    valid_length = total_length and total_length > 0

    if valid_length and is_dumb_terminal():
        widgets = [message, " ", Percentage()]
        maxval = total_length
    elif valid_length and not is_dumb_terminal():
        widgets = [message, Bar(marker="=", left="[", right="]"), " ", Percentage()]
        maxval = total_length
    elif not valid_length and is_dumb_terminal():
        widgets = [message]
        maxval = UnknownLength
    else:
        widgets = [message, AnimatedMarker()]
        maxval = UnknownLength

    return ProgressBar(widgets=widgets, maxval=maxval) 
Example #2
Source File: diskover.py    From diskover with Apache License 2.0 5 votes vote down vote up
def progress_bar(event):
    if event == 'Checking' or event == 'Calculating':
        widgets = [progressbar.AnimatedMarker(), ' ', event + ' (Queue: ', progressbar.Counter(), ') ', progressbar.Timer()]
        bar = progressbar.ProgressBar(widgets=widgets, max_value=progressbar.UnknownLength)
    else:
        widgets = [event + ' ', progressbar.Bar(), progressbar.Percentage(),
            ' (', progressbar.Timer(), ', ', progressbar.ETA(), ')']
        bar = progressbar.ProgressBar(widgets=widgets, max_value=100)
    return bar 
Example #3
Source File: cmc.py    From STE-NVAN with MIT License 5 votes vote down vote up
def Cmc(q_data, g_data, rank_size):
    n_query = q_data['feature'].shape[0]
    n_gallery = g_data['feature'].shape[0]

    dist = np_cdist(q_data['feature'], g_data['feature']) # Reture a n_query*n_gallery array

    cmc = np.zeros((n_query, rank_size))
    ap = np.zeros(n_query)
    
    widgets = ["I'm calculating cmc! ", AnimatedMarker(markers='←↖↑↗→↘↓↙'), ' (', Percentage(), ')']
    pbar = ProgressBar(widgets=widgets, max_value=n_query)
    for k in range(n_query):
        good_idx = np.where((q_data['id'][k]==g_data['id']) & (q_data['cam'][k]!=g_data['cam']))[0]
        junk_mask1 = (g_data['id'] == -1)
        junk_mask2 = (q_data['id'][k]==g_data['id']) & (q_data['cam'][k]==g_data['cam'])
        junk_idx = np.where(junk_mask1 | junk_mask2)[0]
        score = dist[k, :]
        sort_idx = np.argsort(score)
        sort_idx = sort_idx[:rank_size]

        ap[k], cmc[k, :] = Compute_AP(good_idx, junk_idx, sort_idx)
        pbar.update(k)
    pbar.finish()
    CMC = np.mean(cmc, axis=0)
    mAP = np.mean(ap)
    return CMC, mAP 
Example #4
Source File: ProgressManager.py    From EventMonkey with Apache License 2.0 5 votes vote down vote up
def __init__(self,interface_type,count=None,description=None):
        self.interface_type = interface_type
        self.current_value = 0
        
        if self.interface_type == Config.UI_CLI:
            widgets = []
            
            if description is not None:
                widgets.append('{}: '.format(description))
            
            if count is not None:
                widgets.append(Percentage())
                widgets.append(' ')
                widgets.append(Bar())
            else:
                widgets.append(Counter())
                widgets.append(' ')
                widgets.append(AnimatedMarker(markers='.oO@* '))
                
            if count is not None:
                self.progressBar = ProgressBar(widgets=widgets, max_value=count)
            else:
                self.progressBar = ProgressBar(max_value=progressbar.UnknownLength,widgets=widgets)
        else:
            PROGRESS_LOGGER.error('interface type not handled: {}'.format(self.interface_type))
            raise Exception('interface type not handled: {}'.format(self.interface_type))