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


"""Bridge Example

Should display:

- foo <pid>
. bar <pid>

Where <pid> is the parent and child process id respectively.y
"""


from __future__ import print_function

from os import getpid


from circuits import Component, Event


class foo(Event):
    """foo Event"""


class bar(Event):
    """bar Event"""


class App(Component):

    def foo(self):
        return "foo ({0:d})".format(getpid())

    def started(self, *args):
        x = yield self.call(foo())
        print(x.value)

        y = yield self.call(bar())
        print(y.value)

        raise SystemExit(0)


class SubApp(Component):

    def bar(self):
        return "bar ({0:d})".format(getpid())


app = App()
SubApp().start(process=True, link=app)
app.run()<commit_msg>Backed out 6f2b203a0f97<commit_after>#!/usr/bin/python -i

"""Bridge Example

To use this example run it interactively through the Python interactive
shell using the -i option as per the shebang line above.

i.e: python -i hello_bridge.py

At the python prompt:

    >>> x = m.fire(Hello())
    .
    .
    .
    >>> x
    <Value ('Hello World! (15969)') result: True errors: False for <Hello[*.hello] ( )>
"""  # noqa


from os import getpid


from circuits import Component, Debugger, Event, Manager


class hello(Event):
    """hello Event"""


class App(Component):

    def hello(self):
        return "Hello World! ({0:d})".format(getpid())


m = Manager() + Debugger()
m.start()
App().start(process=True, link=m)
{'fraction_non_alphanumeric': 0.1478029294274301, 'fraction_numerical': 0.011318242343541944, 'mean_word_length': 3.1983240223463687, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 13, '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': '3794076', 'n_tokens_mistral': 523, 'n_tokens_neox': 486, 'n_words': 151}