<commit_before>from bouncebox.core.component import Component
from bouncebox.core.errors import EndOfSources
from bouncebox.core.event import EndEvent

__all__ = ['BounceBox']

class BounceBox(Component):
    """
        This class contains everything
    """
    def __init__(self):
        super(BounceBox, self).__init__()
        self.sources = []

    def start_box(self, mode='auto', interactive=False):
        """
            Starts the bounce box and calls start on the sources
        """
        if len(self.sources) == 0:
           print "No Sources Attached. Exiting..."
           return
        if interactive:
            self.start_interactive()
        elif mode == 'auto':
            self.start_auto()

    def start_auto(self):
        while True:
            try:
                self.send_next()
            except EndOfSources:
                print 'Done Running Sources'
                break

    def start_interactive(self):
        print """ Interactive Mode 
            Press Enter for one iteration
            Press a number for that many iterations
            Type stop to end session"""
        while True:
            key = raw_input('\nNext ')
            if key == 'stop':
                break
            if key is '':
                key = 1
            try:
                key = int(key)
            except:
                print 'Input is wrong'
                continue<commit_msg>changed autorun to a bool<commit_after>from bouncebox.core.component import Component
from bouncebox.core.errors import EndOfSources
from bouncebox.core.event import EndEvent

__all__ = ['BounceBox']

class BounceBox(Component):
    """
        This class contains everything
    """
    def __init__(self):
        super(BounceBox, self).__init__()
        self.sources = []

    def start_box(self, autorun=True, interactive=False):
        """
            Starts the bounce box and calls start on the sources

            autorun: iterate through sources until completion
            interactive: starts prompt
        """
        if len(self.sources) == 0:
           print "No Sources Attached. Exiting..."
           return
        if interactive:
            self.start_interactive()
        elif autorun:
            self.start_auto()

    def start_auto(self):
        while True:
            try:
                self.send_next()
            except EndOfSources:
                print 'Done Running Sources'
                break

    def start_interactive(self):
        print """ Interactive Mode 
            Press Enter for one iteration
            Press a number for that many iterations
            Type stop to end session"""
        while True:
            key = raw_input('\nNext ')
            if key == 'stop':
                break
            if key is '':
                key = 1
            try:
                key = int(key)
            except:
                print 'Input is wrong'
                continue
{'fraction_non_alphanumeric': 0.07827260458839407, 'fraction_numerical': 0.001349527665317139, 'mean_word_length': 1.5277067348678601, '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': '5356181', 'n_tokens_mistral': 755, 'n_tokens_neox': 712, 'n_words': 235}