1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
from __future__ import absolute_import
from errbot import BotFlow, FlowRoot, botflow
class FlowDefinitions(BotFlow):
"""A plugin to test the flows
see flowtest.png for the structure.
"""
@botflow
def w1(self, flow: FlowRoot):
"documentation of W1"
a_node = flow.connect("a") # no autotrigger
b_node = a_node.connect("b")
c_node = a_node.connect("c") # crosses the autotrigger of w2
d_node = c_node.connect("d")
assert a_node.hints
assert b_node.hints
assert c_node.hints
assert d_node.hints
@botflow
def w2(self, flow: FlowRoot):
"""documentation of W2"""
c_node = flow.connect("c", auto_trigger=True)
b_node = c_node.connect("b")
e_node = flow.connect(
"e", auto_trigger=True
) # 2 autotriggers for the same workflow
d_node = e_node.connect("d")
@botflow
def w3(self, flow: FlowRoot):
"""documentation of W3"""
c_node = flow.connect("a", room_flow=True)
b_node = c_node.connect("b")
@botflow
def w4(self, flow: FlowRoot):
"""documentation of W4"""
a_node = flow.connect("a")
b_node = a_node.connect("b")
c_node = b_node.connect("c")
c_node.connect("d")
# set some hinting.
flow.hints = False
a_node.hints = False
b_node.hints = True
c_node.hint = False
|