コード例 #1
0
ファイル: basic.py プロジェクト: smurfix/HomEvenT
    prio = 5

    def does_event(self, e):
        return e[0] == "say more"

    def process(self, event=None, **k):
        super(SayMoreWorker, self).process(event=event, **k)
        w = WorkSequence(event, self)
        w.append(SayWorker("TellOne"))
        w.append(SayWorker("TellTwo"))
        return w


from test import run_logger

run_logger("basic")

hello_ev = Event(Context(), "say", "hello")
hello2_ev = Event(Context(), "say more", "greeting")

register_worker(SayWorker("TellMe"))
register_worker(SayMoreWorker("say something"))


def main():
    try:
        process_event(hello_ev)
        process_event(hello2_ev)
    finally:
        shut_down()
コード例 #2
0
ファイル: mod_parser.py プロジェクト: pombreda/MoaT
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##  GNU General Public License (included; see the file LICENSE)
##  for more details.
##

from homevent import patch;patch()
from homevent.interpreter import Interpreter
from homevent.statement import Statement,ComplexStatement,main_words
from homevent.reactor import ShutdownHandler
from homevent.module import load_module
from homevent.base import Name

from test import run, run_logger
 
log = run_logger("parser",dot=False).log

input = """\

# call FooHandler(main).run(⌁.foo)
foo
# call FooHandler(main).run(⌁.foo¦baz)
foo baz
# call FooHandler(main).run(⌁.foo¦baz)
foo bar
# call BarHandler(main).run(⌁.foo¦bar¦baz)
foo bar baz
# call BarHandler(main).start_block("baz","quux")
foo bar baz quux:
	# call WhatHandler(bar).run(⌁.what¦ever)
	what ever
コード例 #3
0
ファイル: mod_parser.py プロジェクト: ZigmundRat/moat
##
##  This header is auto-generated and may self-destruct at any time,
##  courtesy of "make update". The original is in ‘scripts/_boilerplate.py’.
##  Thus, do not remove the next line, or insert any blank lines above.
##BP

from moat import patch;patch()
from moat.interpreter import Interpreter
from moat.statement import Statement,ComplexStatement,main_words
from moat.reactor import ShutdownHandler
from moat.module import load_module
from moat.base import Name

from test import run, run_logger
 
log = run_logger("parser",dot=False).log

input = """\

# call FooHandler(main).run(⌁.foo)
foo
# call FooHandler(main).run(⌁.foo¦baz)
foo baz
# call FooHandler(main).run(⌁.foo¦baz)
foo bar
# call BarHandler(main).run(⌁.foo¦bar¦baz)
foo bar baz
# call BarHandler(main).start_block("baz","quux")
foo bar baz quux:
	# call WhatHandler(bar).run(⌁.what¦ever)
	what ever