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:
Mark Mossberg
2017-02-27 15:44:33 -05:00
committed by GitHub
parent 98567efeaa
commit d6393cc8a6
7 changed files with 44 additions and 24 deletions
+1 -2
View File
@@ -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."