Mercurial > hg > IntentMadeManifest
annotate intentmademanifest/api.py @ 5:24417b83ef29
polish a bit
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 15 Apr 2013 22:14:49 -0700 |
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""" |