Add hook decorator (#28)
* Add m.add_hook test * Add @m.hook test * Add `hook` decorator for convenience * Update readme and examples * Update run_callback * Improve `add_hook` docstring expound on callback structure * Rm debug print * Improve docstring
This commit is contained in:
@@ -19,11 +19,10 @@ if __name__ == '__main__':
|
||||
m.workers = 3
|
||||
m.context['count'] = 0
|
||||
|
||||
@m.hook(None)
|
||||
def explore(state):
|
||||
m.context['count'] += 1
|
||||
|
||||
m.add_hook(None, explore)
|
||||
|
||||
m.run()
|
||||
|
||||
print "Executed ", m.context['count'], " instructions."
|
||||
|
||||
Reference in New Issue
Block a user