def update(self, current, values=[], force=False):
for k, v in values:<EOL><INDENT>if k not in self.sum_values:<EOL><INDENT>self.sum_values[k] = [v * (current - self.seen_so_far),<EOL>current - self.seen_so_far]<EOL>self.unique_values.append(k)<EOL><DEDENT>else:<EOL><INDENT>self.sum_values[k][<NUM_LIT:0>] += v * (current - self.seen_so_far)<EOL>self.sum_values[k][<NUM_LIT:1>] += (current - self.seen_so_far)<EOL><DEDENT><DEDENT>self.seen_so_far = current<EOL>now = time.time()<EOL>if self.verbose == <NUM_LIT:1>:<EOL><INDENT>if not force and (now - self.last_update) < self.interval:<EOL><INDENT>return<EOL><DEDENT>prev_total_width = self.total_width<EOL>sys.stdout.write('<STR_LIT>' * prev_total_width)<EOL>sys.stdout.write('<STR_LIT:\r>')<EOL>numdigits = int(np.floor(np.log10(self.target))) + <NUM_LIT:1><EOL>barstr = '<STR_LIT>' % (numdigits, numdigits)<EOL>bar = barstr % (current, self.target)<EOL>prog = float(current) / self.target<EOL>prog_width = int(self.width * prog)<EOL>if prog_width > <NUM_LIT:0>:<EOL><INDENT>bar += ('<STR_LIT:=>' * (prog_width-<NUM_LIT:1>))<EOL>if current < self.target:<EOL><INDENT>bar += '<STR_LIT:>>'<EOL><DEDENT>else:<EOL><INDENT>bar += '<STR_LIT:=>'<EOL><DEDENT><DEDENT>bar += ('<STR_LIT:.>' * (self.width - prog_width))<EOL>bar += '<STR_LIT:]>'<EOL>sys.stdout.write(bar)<EOL>self.total_width = len(bar)<EOL>if current:<EOL><INDENT>time_per_unit = (now - self.start) / current<EOL><DEDENT>else:<EOL><INDENT>time_per_unit = <NUM_LIT:0><EOL><DEDENT>eta = time_per_unit * (self.target - current)<EOL>info = '<STR_LIT>'<EOL>if current < self.target:<EOL><INDENT>info += '<STR_LIT>' % eta<EOL><DEDENT>else:<EOL><INDENT>info += '<STR_LIT>' % (now - self.start)<EOL><DEDENT>for k in self.unique_values:<EOL><INDENT>info += '<STR_LIT>' % k<EOL>if isinstance(self.sum_values[k], list):<EOL><INDENT>avg = self.sum_values[k][<NUM_LIT:0>] / max(<NUM_LIT:1>, self.sum_values[k][<NUM_LIT:1>])<EOL>if abs(avg) > <NUM_LIT>:<EOL><INDENT>info += '<STR_LIT>' % avg<EOL><DEDENT>else:<EOL><INDENT>info += '<STR_LIT>' % avg<EOL><DEDENT><DEDENT>else:<EOL><INDENT>info += '<STR_LIT>' % self.sum_values[k]<EOL><DEDENT><DEDENT>self.total_width += len(info)<EOL>if prev_total_width > self.total_width:<EOL><INDENT>info += ((prev_total_width - self.total_width) * '<STR_LIT:U+0020>')<EOL><DEDENT>sys.stdout.write(info)<EOL>sys.stdout.flush()<EOL>if current >= self.target:<EOL><INDENT>sys.stdout.write('<STR_LIT:\n>')<EOL><DEDENT><DEDENT>if self.verbose == <NUM_LIT:2>:<EOL><INDENT>if current >= self.target:<EOL><INDENT>info = '<STR_LIT>' % (now - self.start)<EOL>for k in self.unique_values:<EOL><INDENT>info += '<STR_LIT>' % k<EOL>avg = self.sum_values[k][<NUM_LIT:0>] / max(<NUM_LIT:1>, self.sum_values[k][<NUM_LIT:1>])<EOL>if avg > <NUM_LIT>:<EOL><INDENT>info += '<STR_LIT>' % avg<EOL><DEDENT>else:<EOL><INDENT>info += '<STR_LIT>' % avg<EOL><DEDENT><DEDENT>sys.stdout.write(info + "<STR_LIT:\n>")<EOL><DEDENT><DEDENT>self.last_update = now<EOL>
Updates the progress bar.

        # Arguments
            current: Index of current step.
            values: List of tuples (name, value_for_last_step).
                The progress bar will display averages for these values.
            force: Whether to force visual progress update.