Created
July 2, 2015 09:21
-
-
Save prologic/906cfa506c7f409f6a3d to your computer and use it in GitHub Desktop.
created by github.com/tr3buchet/gister
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(circuits) | |
prologic@daisy | |
Thu Jul 02 19:22:11 | |
~/circuits | |
$ python | |
Python 2.7.9 (default, Mar 19 2015, 22:32:11) | |
[GCC 4.8.4] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from circuits import Component, Event, Debugger | |
>>> class foo(Event): | |
... """foo Event""" | |
... | |
>>> foo.success = True | |
>>> foo.complete = True | |
>>> | |
>>> class App(Component): | |
... | |
File "<stdin>", line 2 | |
^ | |
IndentationError: expected an indented block | |
>>> class App(Component): | |
... def foo(self, *args, **kwargs): | |
... print args, kwargs | |
... def foo_success(self, event, *args, **kwargs): | |
... print "success!", args, kwargs | |
... def foo_complete(self, event, *args, **kwargs): | |
... print "complete!", args, kwargs | |
... | |
>>> app = App() + Debugger() | |
>>> app.start() | |
<registered[*] (<Debugger/* 13204:App (queued=0) [S]>, <App/* 13204:App (queued=2) [R]> )> | |
(<Thread(App, started daemon 140016600090368)>, None) | |
>>> <started[*] (<App/* 13204:App (queued=1) [R]> )> | |
>>> x = app.fire(foo()) | |
>>> <foo[*] ( )> | |
() {} | |
<foo_success[*] (<foo[*] ( )>, None )> | |
success! (<foo[*] ( )>, None) {} | |
<foo_complete[*] (<foo[*] ( )>, None )> | |
complete! (<foo[*] ( )>, None) {} | |
>>> x | |
<Value () result=False; errors=False; for <foo[*] ( )> | |
>>> App().register(app) | |
<App/* 13204:MainThread (queued=0) [S]> | |
>>> <registered[*] (<App/* 13204:App (queued=0) [S]>, <App/* 13204:App (queued=1) [R]> )> | |
>>> y = app.fire(foo()) | |
>>> <foo[*] ( )> | |
() {} | |
() {} | |
<foo_success[*] (<foo[*] ( )>, None )> | |
success! (<foo[*] ( )>, None) {} | |
success! (<foo[*] ( )>, None) {} | |
<foo_complete[*] (<foo[*] ( )>, None )> | |
complete! (<foo[*] ( )>, None) {} | |
complete! (<foo[*] ( )>, None) {} | |
>>> y | |
<Value () result=False; errors=False; for <foo[*] ( )> | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment