def show(self, progress, count=None):
        """
        @type progress: int
        @type count: str, None
        @return: None
        """
        stream = sys.stderr
        bar_template = '%s|%s%s| \033[34m%s/%s - %s\033[0m\r'

        # How long to wait before recalculating the ETA
        eta_interval = 1

        # How many intervals (excluding the current one) to calculate the simple moving
        # average
        eta_sma_window = 14

        if count is not None:
            self.expected_size = count

        if self.expected_size is None:
            raise Exception("expected_size not initialized")

        self.last_progress = "%.2f" % progress
        self.label = "\033[33m" + self.label + "\033[0m"

        if (time.time() - self.etadelta) > eta_interval:
            self.etadelta = time.time()
            self.ittimes = self.ittimes[-eta_sma_window:] + [-(self.start - time.time()) / (progress + 1)]
            self.eta = sum(self.ittimes) / float(len(self.ittimes)) * (self.expected_size - progress)
            self.etadisp = self.format_time(int(self.eta))

        x = int(self.width * progress // self.expected_size)

        if not self.hide:
            if ((progress % self.every) == 0 or  # True every "every" updates
                    (progress == self.expected_size)):  # And when we're done

                if len(remove_color(self.label.strip())) == 0:
                    bar_template = '%s|%s%s| \033[34m%s/%s\033[0m\r'
                    stream.write(bar_template % (
                        self.etadisp, self.filled_char * x,
                        self.empty_char * (self.width - x), sizeof_fmt(progress),
                        sizeof_fmt(self.expected_size)))
                else:
                    stream.write(bar_template % (
                        self.label, self.filled_char * x,
                        self.empty_char * (self.width - x), sizeof_fmt(progress + 1),
                        sizeof_fmt(self.expected_size), self.etadisp))

                stream.flush()
def show ( self , progress , count = None ) : stream = sys . stderr bar_template = '%s|%s%s| \033[34m%s/%s - %s\033[0m\r' eta_interval = 1 eta_sma_window = 14 if count is not None : self . expected_size = count if self . expected_size is None : raise Exception ( "expected_size not initialized" ) self . last_progress = "%.2f" % progress self . label = "\033[33m" + self . label + "\033[0m" if ( time . time ( ) - self . etadelta ) > eta_interval : self . etadelta = time . time ( ) self . ittimes = self . ittimes [ - eta_sma_window : ] + [ - ( self . start - time . time ( ) ) / ( progress + 1 ) ] self . eta = sum ( self . ittimes ) / float ( len ( self . ittimes ) ) * ( self . expected_size - progress ) self . etadisp = self . format_time ( int ( self . eta ) ) x = int ( self . width * progress // self . expected_size ) if not self . hide : if ( ( progress % self . every ) == 0 or ( progress == self . expected_size ) ) : if len ( remove_color ( self . label . strip ( ) ) ) == 0 : bar_template = '%s|%s%s| \033[34m%s/%s\033[0m\r' stream . write ( bar_template % ( self . etadisp , self . filled_char * x , self . empty_char * ( self . width - x ) , sizeof_fmt ( progress ) , sizeof_fmt ( self . expected_size ) ) ) else : stream . write ( bar_template % ( self . label , self . filled_char * x , self . empty_char * ( self . width - x ) , sizeof_fmt ( progress + 1 ) , sizeof_fmt ( self . expected_size ) , self . etadisp ) ) stream . flush ( )
@type progress: int
        @type count: str, None
        @return: None