|
33 | 33 | " def on_cycle(self, event_data=None):\n", |
34 | 34 | " return \"Running {} from {} to {}\".format(\n", |
35 | 35 | " event_data.event.name,\n", |
36 | | - " event_data.transition.source.identifier,\n", |
37 | | - " event_data.transition.destination.identifier,\n", |
| 36 | + " event_data.transition.source.id,\n", |
| 37 | + " event_data.transition.target.id,\n", |
38 | 38 | " )\n", |
39 | 39 | " \n", |
40 | 40 | " def on_enter_state(self):\n", |
|
52 | 52 | "outputs": [ |
53 | 53 | { |
54 | 54 | "data": { |
55 | | - "image/svg+xml": [ |
56 | | - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", |
57 | | - "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", |
58 | | - " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", |
59 | | - "<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n", |
60 | | - " -->\n", |
61 | | - "<!-- Title: list Pages: 1 -->\n", |
62 | | - "<svg width=\"543pt\" height=\"93pt\"\n", |
63 | | - " viewBox=\"0.00 0.00 543.00 93.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", |
64 | | - "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 89)\">\n", |
65 | | - "<title>list</title>\n", |
66 | | - "<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-89 539,-89 539,4 -4,4\"/>\n", |
67 | | - "<text text-anchor=\"middle\" x=\"267.5\" y=\"-7\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">TrafficLightMachine</text>\n", |
68 | | - "<!-- i -->\n", |
69 | | - "<g id=\"node1\" class=\"node\">\n", |
70 | | - "<title>i</title>\n", |
71 | | - "<ellipse fill=\"#000000\" stroke=\"#000000\" cx=\"7\" cy=\"-37\" rx=\"7\" ry=\"7\"/>\n", |
72 | | - "<text text-anchor=\"middle\" x=\"7\" y=\"-36.7\" font-family=\"Times,serif\" font-size=\"1.00\" fill=\"#000000\">i</text>\n", |
73 | | - "</g>\n", |
74 | | - "<!-- green -->\n", |
75 | | - "<g id=\"node2\" class=\"node\">\n", |
76 | | - "<title>green</title>\n", |
77 | | - "<path fill=\"#40e0d0\" stroke=\"#000000\" stroke-width=\"2\" d=\"M144,-55C144,-55 63,-55 63,-55 57,-55 51,-49 51,-43 51,-43 51,-31 51,-31 51,-25 57,-19 63,-19 63,-19 144,-19 144,-19 150,-19 156,-25 156,-31 156,-31 156,-43 156,-43 156,-49 150,-55 144,-55\"/>\n", |
78 | | - "<text text-anchor=\"middle\" x=\"103.5\" y=\"-40\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">Green</text>\n", |
79 | | - "<text text-anchor=\"middle\" x=\"103.5\" y=\"-29\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">entry / on_enter_state</text>\n", |
80 | | - "</g>\n", |
81 | | - "<!-- i->green -->\n", |
82 | | - "<g id=\"edge1\" class=\"edge\">\n", |
83 | | - "<title>i->green</title>\n", |
84 | | - "<path fill=\"none\" stroke=\"#0000ff\" d=\"M14.2532,-37C20.4952,-37 30.1691,-37 40.8829,-37\"/>\n", |
85 | | - "<polygon fill=\"#0000ff\" stroke=\"#0000ff\" points=\"40.9459,-40.5001 50.9459,-37 40.9459,-33.5001 40.9459,-40.5001\"/>\n", |
86 | | - "</g>\n", |
87 | | - "<!-- yellow -->\n", |
88 | | - "<g id=\"node3\" class=\"node\">\n", |
89 | | - "<title>yellow</title>\n", |
90 | | - "<path fill=\"#ffffff\" stroke=\"#000000\" d=\"M304,-85C304,-85 223,-85 223,-85 217,-85 211,-79 211,-73 211,-73 211,-61 211,-61 211,-55 217,-49 223,-49 223,-49 304,-49 304,-49 310,-49 316,-55 316,-61 316,-61 316,-73 316,-73 316,-79 310,-85 304,-85\"/>\n", |
91 | | - "<text text-anchor=\"middle\" x=\"263.5\" y=\"-70\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">Yellow</text>\n", |
92 | | - "<text text-anchor=\"middle\" x=\"263.5\" y=\"-59\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">entry / on_enter_state</text>\n", |
93 | | - "</g>\n", |
94 | | - "<!-- green->yellow -->\n", |
95 | | - "<g id=\"edge2\" class=\"edge\">\n", |
96 | | - "<title>green->yellow</title>\n", |
97 | | - "<path fill=\"none\" stroke=\"#0000ff\" d=\"M156.3334,-46.9063C170.6072,-49.5826 186.1902,-52.5044 200.9416,-55.2703\"/>\n", |
98 | | - "<polygon fill=\"#0000ff\" stroke=\"#0000ff\" points=\"200.5211,-58.7524 210.9949,-57.1553 201.8112,-51.8723 200.5211,-58.7524\"/>\n", |
99 | | - "<text text-anchor=\"middle\" x=\"183.5\" y=\"-54.8\" font-family=\"Times,serif\" font-size=\"9.00\" fill=\"#000000\">cycle</text>\n", |
100 | | - "</g>\n", |
101 | | - "<!-- red -->\n", |
102 | | - "<g id=\"node4\" class=\"node\">\n", |
103 | | - "<title>red</title>\n", |
104 | | - "<path fill=\"#ffffff\" stroke=\"#000000\" d=\"M523,-55C523,-55 383,-55 383,-55 377,-55 371,-49 371,-43 371,-43 371,-31 371,-31 371,-25 377,-19 383,-19 383,-19 523,-19 523,-19 529,-19 535,-25 535,-31 535,-31 535,-43 535,-43 535,-49 529,-55 523,-55\"/>\n", |
105 | | - "<text text-anchor=\"middle\" x=\"453\" y=\"-40\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">Red</text>\n", |
106 | | - "<text text-anchor=\"middle\" x=\"453\" y=\"-29\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">entry / on_enter_state, on_enter_red</text>\n", |
107 | | - "</g>\n", |
108 | | - "<!-- yellow->red -->\n", |
109 | | - "<g id=\"edge4\" class=\"edge\">\n", |
110 | | - "<title>yellow->red</title>\n", |
111 | | - "<path fill=\"none\" stroke=\"#0000ff\" d=\"M316.0347,-58.6832C329.9618,-56.4783 345.4185,-54.0314 360.7861,-51.5985\"/>\n", |
112 | | - "<polygon fill=\"#0000ff\" stroke=\"#0000ff\" points=\"361.5254,-55.0251 370.8551,-50.0045 360.4308,-48.1112 361.5254,-55.0251\"/>\n", |
113 | | - "<text text-anchor=\"middle\" x=\"343.5\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"9.00\" fill=\"#000000\">cycle</text>\n", |
114 | | - "</g>\n", |
115 | | - "<!-- red->green -->\n", |
116 | | - "<g id=\"edge3\" class=\"edge\">\n", |
117 | | - "<title>red->green</title>\n", |
118 | | - "<path fill=\"none\" stroke=\"#0000ff\" d=\"M370.8015,-32.1163C352.753,-31.2349 333.737,-30.4528 316,-30 269.3485,-28.809 257.642,-28.483 211,-30 196.4955,-30.4717 180.9077,-31.3006 166.2257,-32.2268\"/>\n", |
119 | | - "<polygon fill=\"#0000ff\" stroke=\"#0000ff\" points=\"165.9807,-28.7352 156.2304,-32.8803 166.4375,-35.7203 165.9807,-28.7352\"/>\n", |
120 | | - "<text text-anchor=\"middle\" x=\"263.5\" y=\"-32.8\" font-family=\"Times,serif\" font-size=\"9.00\" fill=\"#000000\">cycle</text>\n", |
121 | | - "</g>\n", |
122 | | - "</g>\n", |
123 | | - "</svg>\n" |
124 | | - ], |
| 55 | + "image/svg+xml": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n -->\n<!-- Title: list Pages: 1 -->\n<svg width=\"543pt\" height=\"93pt\"\n viewBox=\"0.00 0.00 543.00 93.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 89)\">\n<title>list</title>\n<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-89 539,-89 539,4 -4,4\"/>\n<text text-anchor=\"middle\" x=\"267.5\" y=\"-7\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">TrafficLightMachine</text>\n<!-- i -->\n<g id=\"node1\" class=\"node\">\n<title>i</title>\n<ellipse fill=\"#000000\" stroke=\"#000000\" cx=\"7\" cy=\"-37\" rx=\"7\" ry=\"7\"/>\n<text text-anchor=\"middle\" x=\"7\" y=\"-36.7\" font-family=\"Times,serif\" font-size=\"1.00\" fill=\"#000000\">i</text>\n</g>\n<!-- green -->\n<g id=\"node2\" class=\"node\">\n<title>green</title>\n<path fill=\"#40e0d0\" stroke=\"#000000\" stroke-width=\"2\" d=\"M144,-55C144,-55 63,-55 63,-55 57,-55 51,-49 51,-43 51,-43 51,-31 51,-31 51,-25 57,-19 63,-19 63,-19 144,-19 144,-19 150,-19 156,-25 156,-31 156,-31 156,-43 156,-43 156,-49 150,-55 144,-55\"/>\n<text text-anchor=\"middle\" x=\"103.5\" y=\"-40\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">Green</text>\n<text text-anchor=\"middle\" x=\"103.5\" y=\"-29\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">entry / on_enter_state</text>\n</g>\n<!-- i->green -->\n<g id=\"edge1\" class=\"edge\">\n<title>i->green</title>\n<path fill=\"none\" stroke=\"#0000ff\" d=\"M14.2532,-37C20.4952,-37 30.1691,-37 40.8829,-37\"/>\n<polygon fill=\"#0000ff\" stroke=\"#0000ff\" points=\"40.9459,-40.5001 50.9459,-37 40.9459,-33.5001 40.9459,-40.5001\"/>\n</g>\n<!-- yellow -->\n<g id=\"node3\" class=\"node\">\n<title>yellow</title>\n<path fill=\"#ffffff\" stroke=\"#000000\" d=\"M304,-85C304,-85 223,-85 223,-85 217,-85 211,-79 211,-73 211,-73 211,-61 211,-61 211,-55 217,-49 223,-49 223,-49 304,-49 304,-49 310,-49 316,-55 316,-61 316,-61 316,-73 316,-73 316,-79 310,-85 304,-85\"/>\n<text text-anchor=\"middle\" x=\"263.5\" y=\"-70\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">Yellow</text>\n<text text-anchor=\"middle\" x=\"263.5\" y=\"-59\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">entry / on_enter_state</text>\n</g>\n<!-- green->yellow -->\n<g id=\"edge2\" class=\"edge\">\n<title>green->yellow</title>\n<path fill=\"none\" stroke=\"#0000ff\" d=\"M156.3334,-46.9063C170.6072,-49.5826 186.1902,-52.5044 200.9416,-55.2703\"/>\n<polygon fill=\"#0000ff\" stroke=\"#0000ff\" points=\"200.5211,-58.7524 210.9949,-57.1553 201.8112,-51.8723 200.5211,-58.7524\"/>\n<text text-anchor=\"middle\" x=\"183.5\" y=\"-54.8\" font-family=\"Times,serif\" font-size=\"9.00\" fill=\"#000000\">cycle</text>\n</g>\n<!-- red -->\n<g id=\"node4\" class=\"node\">\n<title>red</title>\n<path fill=\"#ffffff\" stroke=\"#000000\" d=\"M523,-55C523,-55 383,-55 383,-55 377,-55 371,-49 371,-43 371,-43 371,-31 371,-31 371,-25 377,-19 383,-19 383,-19 523,-19 523,-19 529,-19 535,-25 535,-31 535,-31 535,-43 535,-43 535,-49 529,-55 523,-55\"/>\n<text text-anchor=\"middle\" x=\"453\" y=\"-40\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">Red</text>\n<text text-anchor=\"middle\" x=\"453\" y=\"-29\" font-family=\"Times,serif\" font-size=\"10.00\" fill=\"#000000\">entry / on_enter_state, on_enter_red</text>\n</g>\n<!-- yellow->red -->\n<g id=\"edge4\" class=\"edge\">\n<title>yellow->red</title>\n<path fill=\"none\" stroke=\"#0000ff\" d=\"M316.0347,-58.6832C329.9618,-56.4783 345.4185,-54.0314 360.7861,-51.5985\"/>\n<polygon fill=\"#0000ff\" stroke=\"#0000ff\" points=\"361.5254,-55.0251 370.8551,-50.0045 360.4308,-48.1112 361.5254,-55.0251\"/>\n<text text-anchor=\"middle\" x=\"343.5\" y=\"-57.8\" font-family=\"Times,serif\" font-size=\"9.00\" fill=\"#000000\">cycle</text>\n</g>\n<!-- red->green -->\n<g id=\"edge3\" class=\"edge\">\n<title>red->green</title>\n<path fill=\"none\" stroke=\"#0000ff\" d=\"M370.8015,-32.1163C352.753,-31.2349 333.737,-30.4528 316,-30 269.3485,-28.809 257.642,-28.483 211,-30 196.4955,-30.4717 180.9077,-31.3006 166.2257,-32.2268\"/>\n<polygon fill=\"#0000ff\" stroke=\"#0000ff\" points=\"165.9807,-28.7352 156.2304,-32.8803 166.4375,-35.7203 165.9807,-28.7352\"/>\n<text text-anchor=\"middle\" x=\"263.5\" y=\"-32.8\" font-family=\"Times,serif\" font-size=\"9.00\" fill=\"#000000\">cycle</text>\n</g>\n</g>\n</svg>\n", |
125 | 56 | "text/plain": [ |
126 | 57 | "TrafficLightMachine(model=Model(state=green), state_field='state', current_state='green')" |
127 | 58 | ] |
|
153 | 84 | "name": "python", |
154 | 85 | "nbconvert_exporter": "python", |
155 | 86 | "pygments_lexer": "ipython3", |
156 | | - "version": "3.8.1" |
| 87 | + "version": "3.8.1 (default, Dec 21 2019, 08:49:15) \n[GCC 7.4.0]" |
| 88 | + }, |
| 89 | + "vscode": { |
| 90 | + "interpreter": { |
| 91 | + "hash": "94f282d658e0bedff3dcf13b7bf6b556458ab0ae44b675c100fba6f748b54e7d" |
| 92 | + } |
157 | 93 | } |
158 | 94 | }, |
159 | 95 | "nbformat": 4, |
|
0 commit comments