def update(self, current, values=[], exact=[], strict=[]):
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), 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>for cells in exact:<EOL><INDENT>k, v, w = cells[<NUM_LIT:0>], cells[<NUM_LIT:1>], <NUM_LIT:4><EOL>if len(cells) == <NUM_LIT:3>:<EOL><INDENT>w = cells[<NUM_LIT:2>]<EOL><DEDENT>if k not in self.sum_values:<EOL><INDENT>self.unique_values.append(k)<EOL><DEDENT>self.sum_values[k] = [v, <NUM_LIT:1>, w]<EOL><DEDENT>for k, v in strict:<EOL><INDENT>if k not in self.sum_values:<EOL><INDENT>self.unique_values.append(k)<EOL><DEDENT>self.sum_values[k] = v<EOL><DEDENT>self.seen_so_far = current<EOL>now = time.time()<EOL>if self.verbose == <NUM_LIT:1>:<EOL><INDENT>prev_total_width = self.total_width<EOL>sys.stdout.write("<STR_LIT>" * prev_total_width)<EOL>sys.stdout.write("<STR_LIT:\r>")<EOL>numdigits = <NUM_LIT:0> if self.target == <NUM_LIT:0> or math.isnan(self.target) else int(np.floor(np.log10(self.target))) + <NUM_LIT:1><EOL>barstr = '<STR_LIT>' % (numdigits, numdigits)<EOL>bar = barstr % (current, self.target)<EOL>prog = <NUM_LIT:0> if self.target == <NUM_LIT:0> else 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>if type(self.sum_values[k]) is list:<EOL><INDENT>info += ('<STR_LIT>' + str(self.sum_values[k][<NUM_LIT:2>]) + '<STR_LIT:f>') % (<EOL>k, self.sum_values[k][<NUM_LIT:0>] / max(<NUM_LIT:1>, self.sum_values[k][<NUM_LIT:1>]))<EOL><DEDENT>else:<EOL><INDENT>info += '<STR_LIT>' % (k, 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, self.sum_values[k][<NUM_LIT:0>] / max(<NUM_LIT:1>, self.sum_values[k][<NUM_LIT:1>]))<EOL><DEDENT>sys.stdout.write(info + "<STR_LIT:\n>")<EOL><DEDENT><DEDENT>
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.
    exact: List of tuples (name, value_for_last_step).
        The progress bar will display these values directly.