Mercurial > hg > IntentMadeManifest
annotate intentmademanifest/api.py @ 19:74ada5cb1cb8 default tip
more tools
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 04 Dec 2015 12:55:31 -0800 |
parents | b8be785f8e87 |
children |
rev | line source |
---|---|
1 | 1 """ |
2 API | |
3 """ | |
4 # TODO: probably to workflow.py, state.py, transition.py | |
5 | |
6 """ | |
7 Example usage [STUB]: | |
8 | |
9 class MyWorkflow(Workflow): | |
10 def __init__(self, **kwargs): | |
11 Workflow.__init__(self, **kwargs) | |
12 """ | |
13 | |
14 class Workflow(object): | |
15 """DG of all workflow""" | |
16 | |
17 def __init__(self, initial_state=None): | |
18 """ | |
19 - initial_state: if settable | |
20 """ | |
21 | |
22 def state(self): | |
23 """ | |
2
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
24 current state; |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
25 returns the current state object |
1 | 26 """ |
2
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
27 |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
28 class State(object): |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
29 """a state""" |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
30 |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
31 def __init__(self, *transitions): |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
32 |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
33 def available(): |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
34 """avalable transitions""" |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
35 |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
36 def transit(): |
b8be785f8e87
lets pretend that were dead...er, doing something
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
37 """invoke a transition""" |