<commit_before>#!/usr/bin/env python
# <NAME> <<EMAIL>>
from AlphaTwirl.ProgressBar import ProgressBar, MPProgressMonitor, ProgressReport
from AlphaTwirl.EventReader import MPEventLoopRunner
import time, random

##____________________________________________________________________________||
class EventLoop(object):
    def __init__(self, name):
        self.name = name
        self.readers = [ ]
    def __call__(self, progressReporter = None):
        n = random.randint(5, 1000000)
        time.sleep(random.randint(0, 3))
        for i in xrange(n):
            time.sleep(0.0001)
            report = ProgressReport(name = self.name, done = i + 1, total = n)
            progressReporter.report(report)
        return self.readers
    def firstReportProgress(self, progressReporter): pass

##____________________________________________________________________________||
progressBar = ProgressBar()
progressMonitor = MPProgressMonitor(presentation = progressBar)
runner = MPEventLoopRunner(progressMonitor = progressMonitor)
runner.begin()
runner.run(EventLoop("loop"))
runner.run(EventLoop("another loop"))
runner.run(EventLoop("more loop"))
runner.run(EventLoop("loop loop loop"))
runner.run(EventLoop("l"))
runner.run(EventLoop("loop6"))
runner.run(EventLoop("loop7"))
runner.run(EventLoop("loop8"))
runner.end()

##____________________________________________________________________________||<commit_msg>update examples/progressbar.py, have the multiple tasks with the same name<commit_after>#!/usr/bin/env python
# <NAME> <<EMAIL>>
from AlphaTwirl.ProgressBar import ProgressBar, MPProgressMonitor, ProgressReport
from AlphaTwirl.EventReader import MPEventLoopRunner
import time, random
import uuid

##____________________________________________________________________________||
class EventLoop(object):
    def __init__(self, name):
        self.name = name
        self.readers = [ ]
    def __call__(self, progressReporter = None):
        n = random.randint(5, 1000000)
        taskid = uuid.uuid4()
        time.sleep(random.randint(0, 3))
        for i in xrange(n):
            time.sleep(0.0001)
            report = ProgressReport(name = self.name, done = i + 1, total = n, taskid = taskid)
            progressReporter.report(report)
        return self.readers
    def firstReportProgress(self, progressReporter): pass

##____________________________________________________________________________||
progressBar = ProgressBar()
progressMonitor = MPProgressMonitor(presentation = progressBar)
runner = MPEventLoopRunner(progressMonitor = progressMonitor)
runner.begin()
runner.run(EventLoop("loop"))
runner.run(EventLoop("another loop"))
runner.run(EventLoop("more loop"))
runner.run(EventLoop("loop loop loop"))
runner.run(EventLoop("l"))
runner.run(EventLoop("loop6"))
runner.run(EventLoop("loop7"))
runner.run(EventLoop("loop8"))
runner.run(EventLoop("loop6"))
runner.end()

##____________________________________________________________________________||
{'fraction_non_alphanumeric': 0.11256281407035176, 'fraction_numerical': 0.01340033500837521, 'mean_word_length': 5.366737739872068, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2936806', 'n_tokens_mistral': 792, 'n_tokens_neox': 763, 'n_words': 168}