# HG changeset patch # User Jeff Hammel # Date 1375161284 25200 # Node ID 734d26329c82db4bd6f04014037c45729df185eb # Parent 4353d36a2f80767d3de445d488f2ef357edbd406 from http://k0s.org/hg/config/file/c328382f68ff/python/actions.py diff -r 4353d36a2f80 -r 734d26329c82 actions.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/actions.py Mon Jul 29 22:14:44 2013 -0700 @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# STUB: from +# http://k0s.org/hg/config/file/c328382f68ff/python/actions.py + +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')