def set_numerator(self, numerator, calculate=True):
        """Sets the new numerator (number of items done).

        Positional arguments:
        numerator -- the new numerator to add to the timing data.

        Keyword arguments:
        calculate -- calculate the ETA and rate by default.
        """
        # Validate
        if self._timing_data and numerator < self._timing_data[-1][1]:
            raise ValueError('numerator cannot decrement.')

        # Update data.
        now = _NOW()
        if self._timing_data and now == self._timing_data[-1][0]:
            self._timing_data[-1] = (now, numerator)  # Overwrite.
        else:
            self._timing_data.append((now, numerator))

        # Calculate ETA and rate.
        if not self.done and calculate and self.started:
            self._calculate()
def set_numerator ( self , numerator , calculate = True ) : if self . _timing_data and numerator < self . _timing_data [ - 1 ] [ 1 ] : raise ValueError ( 'numerator cannot decrement.' ) now = _NOW ( ) if self . _timing_data and now == self . _timing_data [ - 1 ] [ 0 ] : self . _timing_data [ - 1 ] = ( now , numerator ) else : self . _timing_data . append ( ( now , numerator ) ) if not self . done and calculate and self . started : self . _calculate ( )
Sets the new numerator (number of items done).

        Positional arguments:
        numerator -- the new numerator to add to the timing data.

        Keyword arguments:
        calculate -- calculate the ETA and rate by default.