<commit_before># <NAME> <<EMAIL>>
from .WorkingArea import WorkingArea

##__________________________________________________________________||
class TaskPackageDropbox(object):
    """A drop box for task packages.

    It puts task packages in a working area and dispatches runners
    that execute the tasks.

    """
    def __init__(self, workingArea, dispatcher):
        self.workingArea = workingArea
        self.dispatcher = dispatcher

    def open(self):
        self.workingArea.open()
        self.package_indices = [ ]

    def put(self, package):
        package_index, package_path = self.workingArea.put_package(package)
        self.package_indices.append(package_index)
        self.dispatcher.run(self.workingArea.path, package_path)

    def receive(self):
        self.dispatcher.wait()
        results = [self.workingArea.collect_result(i) for i in self.package_indices]<commit_msg>check KeyboardInterrupt<commit_after># <NAME> <<EMAIL>>
import logging

from .WorkingArea import WorkingArea

##__________________________________________________________________||
class TaskPackageDropbox(object):
    """A drop box for task packages.

    It puts task packages in a working area and dispatches runners
    that execute the tasks.

    """
    def __init__(self, workingArea, dispatcher):
        self.workingArea = workingArea
        self.dispatcher = dispatcher

    def open(self):
        self.workingArea.open()
        self.package_indices = [ ]

    def put(self, package):
        package_index, package_path = self.workingArea.put_package(package)
        self.package_indices.append(package_index)
        self.dispatcher.run(self.workingArea.path, package_path)

    def receive(self):
        print 'waiting'
        try:
            self.dispatcher.wait()
        except KeyboardInterrupt:
            logger = logging.getLogger(__name__)
            logger.warning('received KeyboardInterrupt')
            self.dispatcher.terminate()

        results = [self.workingArea.collect_result(i) for i in self.package_indices]
{'fraction_non_alphanumeric': 0.08803501945525292, 'fraction_numerical': 0.0, 'mean_word_length': 3.25879917184265, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1681327', 'n_tokens_mistral': 548, 'n_tokens_neox': 529, 'n_words': 132}