<commit_before>import sys
import os

class ProgressBar(object):
    percent = -1
    bar_length = 40
    i=0.0
    n=0
    message=" "
    def __init__(self,n,message=" "):
        self.n=n
        self.message=message
        rows, columns = os.popen('stty size', 'r').read().split()
        self.bar_length= int(columns) - len(message) - 15


    def __call__(self):
        status = ""
        last   = False
        self.i+=1.0
        progress = self.i/self.n

        if progress >= 1:
            last = True
            progress = 1
            status = "Done\r\n\r"

        block = int(round(self.bar_length*progress))
        percent = round(progress*1000)/10
        if percent > self.percent or last:
            self.percent = percent
            text = "\r" + self.message + " [{0}] {1}% {2} ".format( "#"*block + "-"*(self.bar_length-block), percent, status)
            sys.stdout.write(text)
            sys.stdout.flush()

        if last:
            sys.stdout.write("\r")
            sys.stdout.flush()<commit_msg>Updated progress bar to automatically re-size<commit_after>import sys
import os

class ProgressBar(object):
    percent = -1
    i=0.0
    n=0
    message=" "
    def __init__(self,n,message=" "):
        self.n=n
        self.message=message


    def __call__(self):
        status = ""
        last   = False
        self.i+=1.0
        progress = self.i/self.n

        if progress >= 1:
            last = True
            progress = 1
            status = "Done\r\n\r"

        percent = round(progress*1000)/10

        if percent > self.percent or last:
            self.percent = percent

            rows, columns = os.popen('stty size', 'r').read().split()
            bar_length= int(columns) - len(self.message) - 15
            block = int(round(bar_length*progress))

            text = "\r" + self.message + " [{0}] {1}% {2} ".format( "#"*block + "-"*(bar_length-block), percent, status)
            sys.stdout.write(text)
            sys.stdout.flush()

        if last:
            sys.stdout.write("\r")
            sys.stdout.flush()
{'fraction_non_alphanumeric': 0.14265198659645764, 'fraction_numerical': 0.019147917663954045, 'mean_word_length': 1.7107652399481192, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '190380', 'n_tokens_mistral': 670, 'n_tokens_neox': 636, 'n_words': 144}