Mercurial > hg > config
view python/actions.py @ 371:0f679925616d
add stub to strip irssi timestamps, comments; should be part of textshaper: http://k0s.org/portfolio/ideas/textshaper.py
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sun, 21 Jul 2013 21:31:53 -0700 |
parents | f4594857d606 |
children |
line wrap: on
line source
#!/usr/bin/env python class Actions(object): def __init__(self): self.functions = {} def __call__(self, function, dependencies): import pdb; pdb.set_trace() self.functions[function.func_name] = function return function def do(self, func_name): self.functions[func_name]() action = Actions() @action def foo(): print "hello" @action('foo') def bar(): print "goodbye" if __name__ == '__main__': pass action.do('bar')