def update(self, value=None):
        'Updates the ProgressBar to a new value.'

        if value is not None and value is not UnknownLength:
            if (self.maxval is not UnknownLength and not 0 <= value <= self.maxval):

                raise ValueError('Value out of range')

            self.currval = value

        if not self._need_update():
            return
        if self.start_time is None:
            raise RuntimeError('You must call "start" before calling "update"')

        now = time.time()
        self.seconds_elapsed = now - self.start_time
        self.next_update = self.currval + self.update_interval
        self.fd.write(self._format_line() + '\r')
        self.last_update_time = now
Updates the ProgressBar to a new value.
metadrive/render_pipeline/rplibs/progressbar/__init__.py