<commit_before>#!/usr/bin/env python

from circuits import handler, Component, Debugger, Event


class Foo(Event):
    """Foo Event"""


class Bar(Event):
    """Bar Event"""


class BarDone(Event):
    """fired when Bar is done"""

class Test(Component):

    @handler("started")
    def _on_started(self, *args):
        self.fire(Foo())

    def foo(self):
        self.fire(Bar())
        e = self.wait_event(BarDone)
        print e.args[0]


    def bar(self):
        self.fire(BarDone("Foobar"))

(Test() + Debugger(events=False)).run()

<commit_msg>Now let's make it work like this (See test.py)<commit_after>#!/usr/bin/env python

from circuits import handler, Component, Debugger, Event


class Foo(Event):
    """Foo Event"""


class Bar(Event):
    """Bar Event"""


class BarDone(Event):
    """fired when Bar is done"""

class Test(Component):

    @handler("started")
    def _on_started(self, *args):
        self.fire(Foo())

    def foo(self):
        print self.fire(Bar())

    def bar(self):
        return "Foobar!"

(Test() + Debugger(events=False)).run()

{'fraction_non_alphanumeric': 0.1638888888888889, 'fraction_numerical': 0.000925925925925926, 'mean_word_length': 3.189922480620155, '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': '5050731', 'n_tokens_mistral': 381, 'n_tokens_neox': 345, 'n_words': 92}