Mercurial > hg > config
comparison python/actions.py @ 254:56537ed6ebc6
sample actions file with dependencies (stub)
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Sun, 16 Dec 2012 22:21:17 -0800 |
| parents | |
| children | 1f7325245dc8 |
comparison
equal
deleted
inserted
replaced
| 253:8593b0384d3e | 254:56537ed6ebc6 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 class Actions(object): | |
| 4 | |
| 5 def __init__(self): | |
| 6 self.functions = {} | |
| 7 | |
| 8 def __call__(self, function): | |
| 9 return function | |
| 10 | |
| 11 action = Actions() | |
| 12 | |
| 13 @action | |
| 14 def foo(): | |
| 15 print "hello" | |
| 16 | |
| 17 @action | |
| 18 def bar(): | |
| 19 print "goodbye" | |
| 20 | |
| 21 if __name__ == '__main__': | |
| 22 pass |
