@@ -474,26 +474,25 @@ def format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False, unit='it
474474 else :
475475 l_bar = ''
476476
477- r_bar = '| {0}/{1} [{2}<{3}, {4}{5}]' .format (
478- n_fmt , total_fmt , elapsed_str , remaining_str , rate_fmt , postfix )
477+ r_bar = f'| { n_fmt } /{ total_fmt } [{ elapsed_str } <{ remaining_str } , { rate_fmt } { postfix } ]'
479478
480479 # Custom bar formatting
481480 # Populate a dict with all available progress indicators
482- format_dict = dict (
481+ format_dict = {
483482 # slight extension of self.format_dict
484- n = n , n_fmt = n_fmt , total = total , total_fmt = total_fmt ,
485- elapsed = elapsed_str , elapsed_s = elapsed ,
486- ncols = ncols , desc = prefix or '' , unit = unit ,
487- rate = inv_rate if inv_rate and inv_rate > 1 else rate ,
488- rate_fmt = rate_fmt , rate_noinv = rate ,
489- rate_noinv_fmt = rate_noinv_fmt , rate_inv = inv_rate ,
490- rate_inv_fmt = rate_inv_fmt ,
491- postfix = postfix , unit_divisor = unit_divisor ,
492- colour = colour ,
483+ 'n' : n , ' n_fmt' : n_fmt , ' total' : total , ' total_fmt' : total_fmt ,
484+ ' elapsed' : elapsed_str , ' elapsed_s' : elapsed ,
485+ ' ncols' : ncols , ' desc' : prefix or '' , ' unit' : unit ,
486+ ' rate' : inv_rate if inv_rate and inv_rate > 1 else rate ,
487+ ' rate_fmt' : rate_fmt , ' rate_noinv' : rate ,
488+ ' rate_noinv_fmt' : rate_noinv_fmt , ' rate_inv' : inv_rate ,
489+ ' rate_inv_fmt' : rate_inv_fmt ,
490+ ' postfix' : postfix , ' unit_divisor' : unit_divisor ,
491+ ' colour' : colour ,
493492 # plus more useful definitions
494- remaining = remaining_str , remaining_s = remaining ,
495- l_bar = l_bar , r_bar = r_bar , eta = eta_dt ,
496- ** extra_kwargs )
493+ ' remaining' : remaining_str , ' remaining_s' : remaining ,
494+ ' l_bar' : l_bar , ' r_bar' : r_bar , ' eta' : eta_dt ,
495+ ** extra_kwargs }
497496
498497 # total is known: we can predict some stats
499498 if total :
@@ -551,8 +550,8 @@ def format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False, unit='it
551550 return disp_trim (res , ncols ) if ncols else res
552551 else :
553552 # no total: no progressbar, ETA, just progress stats
554- return '{0}{1}{2} [{3}, {4}{5}]' . format (
555- ( prefix + ": " ) if prefix else '' , n_fmt , unit , elapsed_str , rate_fmt , postfix )
553+ return ( f' { ( prefix + ": " ) if prefix else "" } '
554+ f' { n_fmt } { unit } [ { elapsed_str } , { rate_fmt } { postfix } ]' )
556555
557556 def __new__ (cls , * _ , ** __ ):
558557 instance = object .__new__ (cls )
0 commit comments