Created
December 17, 2013 07:21
-
-
Save saintx/8001278 to your computer and use it in GitHub Desktop.
Example components that extend the Lifecycle base class
This file contains 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
from pycocontainer import Pycocontainer, Lifecycle, Stage | |
class A(Lifecycle): | |
def __init__(self, b): | |
super(A, self).__init__() | |
self.b = b | |
@Lifecycle.startmethod | |
def foo(self, *args): | |
print "Called foo()" | |
@Lifecycle.stopmethod | |
def bar(self, *args): | |
print "Called bar()" | |
@Lifecycle.failmethod | |
def baz(self, *args): | |
print "Called baz()" | |
class B(Lifecycle): | |
def __init__(self): | |
super(B, self).__init__() | |
@Lifecycle.startmethod | |
def funk(self, *args): | |
print "Called funk()" | |
@Lifecycle.stopmethod | |
def soul(self, *args): | |
print "Called soul()" | |
@Lifecycle.failmethod | |
def boogie(self, *args): | |
print "Called boogie()" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment