<commit_before># This file is part of QuTiP.
#
#    QuTiP is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    QuTiP is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with QuTiP.  If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2011 and later, <NAME> & <NAME>
#
###########################################################################

import time

class AbstractProgressBar():
    """
    An abstract progress bar with some shared functionality.

    Example usage:

        n_vec = linspace(0, 10, 100)
        pbar = TextProgressBar(len(n_vec))
        for n in n_vec:
            pbar.update(n)
            compute_with_n(n)
        pbar.finished()

    """

    def __init__(self, iterations=0, chunk_size=10):
        pass

    def start(self, iterations, chunk_size=10):
        pass

    def update(self, n):
        pass

    def finished(self):
       pass


class TextProgressBar(AbstractProgressBar):
    """
    A simple text-based progress bar.
    """

    def __init__(self, iterations=0, chunk_size=10):
        self.start(iterations, chunk_size)

    def start(self, iterations, chunk_size=10):
        self.N = float(iterations)
        self.t_start = time.time()
        self.p_chunk_size = chunk_size
        self.p_chunk = 0

    def update(self, n):
        p = (n / self.N) * 100.0
        if p >= self.p_chunk:
            print("%.2f" % p)
            self.p_chunk += self.p_chunk_size
<commit_msg>improved output format in TextProgressBar<commit_after># This file is part of QuTiP.
#
#    QuTiP is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    QuTiP is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with QuTiP.  If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2011 and later, <NAME> & <NAME>
#
###########################################################################

import time

class AbstractProgressBar():
    """
    An abstract progress bar with some shared functionality.

    Example usage:

        n_vec = linspace(0, 10, 100)
        pbar = TextProgressBar(len(n_vec))
        for n in n_vec:
            pbar.update(n)
            compute_with_n(n)
        pbar.finished()

    """

    def __init__(self, iterations=0, chunk_size=10):
        pass

    def start(self, iterations, chunk_size=10):
        pass

    def update(self, n):
        pass

    def finished(self):
       pass


class TextProgressBar(AbstractProgressBar):
    """
    A simple text-based progress bar.
    """

    def __init__(self, iterations=0, chunk_size=10):
        self.start(iterations, chunk_size)

    def start(self, iterations, chunk_size=10):
        self.N = float(iterations)
        self.t_start = time.time()
        self.p_chunk_size = chunk_size
        self.p_chunk = 0

    def update(self, n):
        p = (n / self.N) * 100.0
        if p >= self.p_chunk:
            print("Completed: %.1f%%" % p)
            self.p_chunk += self.p_chunk_size

{'fraction_non_alphanumeric': 0.12736705577172502, 'fraction_numerical': 0.014007782101167316, 'mean_word_length': 2.637735849056604, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5362013', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1108, 'n_words': 391}