def update(self, pbar):
        'Updates the widget with the current SI prefixed speed.'

        if pbar.seconds_elapsed < 2e-6 or pbar.currval < 2e-6: # =~ 0
            scaled = power = 0
        else:
            speed = pbar.currval / pbar.seconds_elapsed
            power = int(math.log(speed, 1000))
            scaled = speed / 1000.**power

        return self._format % (scaled, self.prefixes[power], self.unit)
def update ( self , pbar ) : if pbar . seconds_elapsed < 2e-6 or pbar . currval < 2e-6 : scaled = power = 0 else : speed = pbar . currval / pbar . seconds_elapsed power = int ( math . log ( speed , 1000 ) ) scaled = speed / 1000. ** power return self . _format % ( scaled , self . prefixes [ power ] , self . unit )
Updates the widget with the current SI prefixed speed.