<commit_before>#!/usr/bin/env python3
from sys import stderr
from shutil import get_terminal_size


def progress(size, current, message=''):
    cols, rows = get_terminal_size()

    if message:
        message = ' (' + message + ')'

    FILLED = ['·' for i in range(current)]
    EMPTY = [' ' for i in range(size - current)]
    BAR = ''.join(FILLED + EMPTY)

    line = '[%s] %s' % (BAR, message)
    spacers = ' ' * (cols - len(line))
    print(line + spacers, end='\r', file=stderr)


if __name__ == '__main__':
    from time import sleep

    size = 10
    for i in range(size + 1):
        progress(size, i, ('a' * size)[:-i] + ' ' + str(i) + ' ' + str(size))
        sleep(1)
<commit_msg>clean up progress.py<commit_after>#!/usr/bin/env python3
from sys import stderr
from shutil import get_terminal_size


def progress(size, current, message=''):
    cols, rows = get_terminal_size()

    FILLED = ['·' for i in range(current)]
    EMPTY = [' ' for i in range(size - current)]
    BAR = ''.join(FILLED + EMPTY)

    line = '[{}] {}'.format(BAR, message)
    spacers = ' ' * (cols - len(line))

    result = line + spacers
    result = result[:cols]
    print(result, end='\r', file=stderr)


if __name__ == '__main__':
    from time import sleep

    size = 10
    for i in range(size + 1):
        progress(size, i, ('a' * size)[:-i] + ' ' + str(i) + ' ' + str(size))
        sleep(1)

{'fraction_non_alphanumeric': 0.17060931899641577, 'fraction_numerical': 0.007168458781362007, 'mean_word_length': 2.78319783197832, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6669228', 'n_tokens_mistral': 526, 'n_tokens_neox': 491, 'n_words': 138}