jaseci 1.4.2.5__py3-none-any.whl → 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of jaseci might be problematic. Click here for more details.

Files changed (186) hide show
  1. jaseci/__init__.py +3 -37
  2. jaseci-2.0.0.dist-info/METADATA +65 -0
  3. jaseci-2.0.0.dist-info/RECORD +4 -0
  4. {jaseci-1.4.2.5.dist-info → jaseci-2.0.0.dist-info}/WHEEL +1 -2
  5. jaseci/VERSION +0 -1
  6. jaseci/cli_tools/__init__.py +0 -0
  7. jaseci/cli_tools/book_tools.py +0 -457
  8. jaseci/cli_tools/jsctl.py +0 -500
  9. jaseci/cli_tools/tests/__init__.py +0 -0
  10. jaseci/cli_tools/tests/test_jsctl.py +0 -556
  11. jaseci/extens/__init__.py +0 -0
  12. jaseci/extens/act_lib/__init__.py +0 -0
  13. jaseci/extens/act_lib/date.py +0 -117
  14. jaseci/extens/act_lib/elastic.py +0 -87
  15. jaseci/extens/act_lib/file.py +0 -76
  16. jaseci/extens/act_lib/file_handler.py +0 -189
  17. jaseci/extens/act_lib/internal.py +0 -18
  18. jaseci/extens/act_lib/jaseci.py +0 -61
  19. jaseci/extens/act_lib/mail.py +0 -10
  20. jaseci/extens/act_lib/maths.py +0 -168
  21. jaseci/extens/act_lib/net.py +0 -191
  22. jaseci/extens/act_lib/rand.py +0 -82
  23. jaseci/extens/act_lib/regex.py +0 -85
  24. jaseci/extens/act_lib/request.py +0 -169
  25. jaseci/extens/act_lib/std.py +0 -235
  26. jaseci/extens/act_lib/storage.py +0 -53
  27. jaseci/extens/act_lib/stripe.py +0 -337
  28. jaseci/extens/act_lib/task.py +0 -13
  29. jaseci/extens/act_lib/tests/__init__.py +0 -0
  30. jaseci/extens/act_lib/tests/std_test_code.py +0 -37
  31. jaseci/extens/act_lib/tests/test_date.py +0 -26
  32. jaseci/extens/act_lib/tests/test_elastic.py +0 -159
  33. jaseci/extens/act_lib/tests/test_file.py +0 -116
  34. jaseci/extens/act_lib/tests/test_file_lib.py +0 -40
  35. jaseci/extens/act_lib/tests/test_mail_lib.py +0 -33
  36. jaseci/extens/act_lib/tests/test_maths.py +0 -147
  37. jaseci/extens/act_lib/tests/test_net_lib.py +0 -62
  38. jaseci/extens/act_lib/tests/test_regex.py +0 -61
  39. jaseci/extens/act_lib/tests/test_std.py +0 -51
  40. jaseci/extens/act_lib/tests/test_std_lib.py +0 -36
  41. jaseci/extens/act_lib/tests/test_url.py +0 -32
  42. jaseci/extens/act_lib/tests/test_vector.py +0 -36
  43. jaseci/extens/act_lib/tests/test_webtool.py +0 -44
  44. jaseci/extens/act_lib/tests/test_zlib.py +0 -24
  45. jaseci/extens/act_lib/url.py +0 -79
  46. jaseci/extens/act_lib/vector.py +0 -157
  47. jaseci/extens/act_lib/webtool.py +0 -28
  48. jaseci/extens/act_lib/zip.py +0 -33
  49. jaseci/extens/api/__init__.py +0 -0
  50. jaseci/extens/api/actions_api.py +0 -170
  51. jaseci/extens/api/alias_api.py +0 -139
  52. jaseci/extens/api/architype_api.py +0 -196
  53. jaseci/extens/api/config_api.py +0 -129
  54. jaseci/extens/api/global_api.py +0 -84
  55. jaseci/extens/api/graph_api.py +0 -167
  56. jaseci/extens/api/health_api.py +0 -20
  57. jaseci/extens/api/interface.py +0 -268
  58. jaseci/extens/api/jac_api.py +0 -171
  59. jaseci/extens/api/jsorc_api.py +0 -316
  60. jaseci/extens/api/logger_api.py +0 -89
  61. jaseci/extens/api/master_api.py +0 -133
  62. jaseci/extens/api/object_api.py +0 -101
  63. jaseci/extens/api/prometheus_api.py +0 -74
  64. jaseci/extens/api/queue_api.py +0 -140
  65. jaseci/extens/api/sentinel_api.py +0 -270
  66. jaseci/extens/api/super_api.py +0 -64
  67. jaseci/extens/api/tests/__init__.py +0 -0
  68. jaseci/extens/api/tests/test_architype_api.py +0 -66
  69. jaseci/extens/api/tests/test_global_api.py +0 -179
  70. jaseci/extens/api/tests/test_graph_api.py +0 -64
  71. jaseci/extens/api/tests/test_logger_api.py +0 -43
  72. jaseci/extens/api/tests/test_object_api.py +0 -20
  73. jaseci/extens/api/tests/test_sentinel_api.py +0 -66
  74. jaseci/extens/api/tests/test_uncommon.py +0 -107
  75. jaseci/extens/api/tests/test_user_api.py +0 -32
  76. jaseci/extens/api/tests/test_walker_api.py +0 -316
  77. jaseci/extens/api/user_api.py +0 -144
  78. jaseci/extens/api/walker_api.py +0 -298
  79. jaseci/extens/api/webhook_api.py +0 -74
  80. jaseci/extens/svc/__init__.py +0 -0
  81. jaseci/extens/svc/elastic_svc.py +0 -366
  82. jaseci/extens/svc/kube_svc.py +0 -432
  83. jaseci/extens/svc/mail_svc.py +0 -156
  84. jaseci/extens/svc/prome_svc.py +0 -378
  85. jaseci/extens/svc/redis_svc.py +0 -63
  86. jaseci/extens/svc/storage_svc.py +0 -193
  87. jaseci/extens/svc/stripe_svc.py +0 -51
  88. jaseci/extens/svc/task_svc.py +0 -155
  89. jaseci/extens/svc/tasks.py +0 -302
  90. jaseci/jac/__init__.py +0 -0
  91. jaseci/jac/interpreter/__init__.py +0 -0
  92. jaseci/jac/interpreter/architype_interp.py +0 -214
  93. jaseci/jac/interpreter/interp.py +0 -1783
  94. jaseci/jac/interpreter/sentinel_interp.py +0 -257
  95. jaseci/jac/interpreter/tests/__init__.py +0 -0
  96. jaseci/jac/interpreter/tests/test_interp.py +0 -42
  97. jaseci/jac/interpreter/walker_interp.py +0 -248
  98. jaseci/jac/ir/__init__.py +0 -0
  99. jaseci/jac/ir/ast.py +0 -73
  100. jaseci/jac/ir/ast_builder.py +0 -249
  101. jaseci/jac/ir/jac_code.py +0 -152
  102. jaseci/jac/ir/passes/__init__.py +0 -6
  103. jaseci/jac/ir/passes/ast_prune_pass.py +0 -9
  104. jaseci/jac/ir/passes/codegen_pass.py +0 -244
  105. jaseci/jac/ir/passes/ir_pass.py +0 -29
  106. jaseci/jac/ir/passes/printer_pass.py +0 -23
  107. jaseci/jac/ir/passes/pt_prune_pass.py +0 -29
  108. jaseci/jac/ir/passes/schedule.py +0 -23
  109. jaseci/jac/ir/passes/stats_pass.py +0 -16
  110. jaseci/jac/jac.g4 +0 -450
  111. jaseci/jac/jac_parse/__init__.py +0 -0
  112. jaseci/jac/jac_parse/jacLexer.py +0 -809
  113. jaseci/jac/jac_parse/jacListener.py +0 -853
  114. jaseci/jac/jac_parse/jacParser.py +0 -9192
  115. jaseci/jac/jac_set.py +0 -119
  116. jaseci/jac/jsci_vm/__init__.py +0 -0
  117. jaseci/jac/jsci_vm/disasm.py +0 -94
  118. jaseci/jac/jsci_vm/inst_ptr.py +0 -31
  119. jaseci/jac/jsci_vm/machine.py +0 -188
  120. jaseci/jac/jsci_vm/op_codes.py +0 -82
  121. jaseci/jac/jsci_vm/tests/__init__.py +0 -0
  122. jaseci/jac/jsci_vm/tests/test_codegen.py +0 -31
  123. jaseci/jac/machine/__init__.py +0 -0
  124. jaseci/jac/machine/jac_scope.py +0 -85
  125. jaseci/jac/machine/jac_value.py +0 -226
  126. jaseci/jac/machine/machine_state.py +0 -383
  127. jaseci/jac/tests/__init__.py +0 -0
  128. jaseci/jac/tests/book_code.py +0 -624
  129. jaseci/jac/tests/test_book.py +0 -380
  130. jaseci/jac/tests/test_lang_14.py +0 -49
  131. jaseci/jsorc/__init__.py +0 -7
  132. jaseci/jsorc/jsorc.py +0 -642
  133. jaseci/jsorc/jsorc_settings.py +0 -211
  134. jaseci/jsorc/jsorc_utils.py +0 -298
  135. jaseci/jsorc/live_actions.py +0 -364
  136. jaseci/jsorc/manifests/__init__.py +0 -0
  137. jaseci/jsorc/manifests/database.yaml +0 -109
  138. jaseci/jsorc/manifests/elastic.yaml +0 -6024
  139. jaseci/jsorc/manifests/prometheus.yaml +0 -1383
  140. jaseci/jsorc/manifests/redis.yaml +0 -64
  141. jaseci/jsorc/memory.py +0 -258
  142. jaseci/jsorc/redis.py +0 -139
  143. jaseci/jsorc/remote_actions.py +0 -157
  144. jaseci/jsorc/tests/__init__.py +0 -0
  145. jaseci/jsorc/tests/test_actions.py +0 -542
  146. jaseci/jsorc/tests/test_jsorc.py +0 -112
  147. jaseci/prim/__init__.py +0 -0
  148. jaseci/prim/ability.py +0 -93
  149. jaseci/prim/architype.py +0 -89
  150. jaseci/prim/edge.py +0 -172
  151. jaseci/prim/element.py +0 -233
  152. jaseci/prim/graph.py +0 -26
  153. jaseci/prim/master.py +0 -64
  154. jaseci/prim/node.py +0 -532
  155. jaseci/prim/obj_mixins.py +0 -235
  156. jaseci/prim/sentinel.py +0 -281
  157. jaseci/prim/super_master.py +0 -31
  158. jaseci/prim/walker.py +0 -261
  159. jaseci/svc/__init__.py +0 -0
  160. jaseci/tests/__init__.py +0 -0
  161. jaseci/tests/infer.py +0 -39
  162. jaseci/tests/jac_test_code.py +0 -1293
  163. jaseci/tests/jac_test_progs.py +0 -774
  164. jaseci/tests/test_core.py +0 -153
  165. jaseci/tests/test_jac.py +0 -824
  166. jaseci/tests/test_node.py +0 -89
  167. jaseci/tests/test_progs.py +0 -702
  168. jaseci/tests/test_stack.py +0 -220
  169. jaseci/tests/test_stripe.py +0 -225
  170. jaseci/utils/__init__.py +0 -0
  171. jaseci/utils/actions/__init__.py +0 -0
  172. jaseci/utils/actions/actions_manager.py +0 -254
  173. jaseci/utils/actions/actions_optimizer.py +0 -516
  174. jaseci/utils/actions/actions_state.py +0 -95
  175. jaseci/utils/file_handler.py +0 -171
  176. jaseci/utils/gprof2dot.py +0 -3786
  177. jaseci/utils/id_list.py +0 -168
  178. jaseci/utils/json_handler.py +0 -70
  179. jaseci/utils/log_utils.py +0 -57
  180. jaseci/utils/test_core.py +0 -62
  181. jaseci/utils/utils.py +0 -387
  182. jaseci-1.4.2.5.dist-info/LICENSE +0 -21
  183. jaseci-1.4.2.5.dist-info/METADATA +0 -39
  184. jaseci-1.4.2.5.dist-info/RECORD +0 -184
  185. jaseci-1.4.2.5.dist-info/entry_points.txt +0 -3
  186. jaseci-1.4.2.5.dist-info/top_level.txt +0 -1
@@ -1,624 +0,0 @@
1
- spawn_graph_node = """
2
- node test_node {has name;}
3
- graph test_graph {
4
- has anchor graph_root;
5
- spawn {
6
- graph_root =
7
- spawn node::test_node(name="graph_root_node_name");
8
- }
9
- }
10
- walker init {
11
- root {
12
- spawn here ++> graph::test_graph;
13
- take --> node::test_node;
14
- }
15
- test_node {
16
- std.out(here.name);
17
- }
18
- }
19
- """
20
-
21
- basic_arith = """
22
- walker init {
23
- a = 4 + 4;
24
- b = 4 * -5;
25
- c = 4 / 4; # Returns a floating point number
26
- d = 4 - 6;
27
- e = a + b + c + d;
28
- std.out(a, b, c, d, e);
29
- }
30
- """
31
-
32
- more_arith = """
33
- walker init {
34
- a = 4 ^ 4; b = 9 % 5; std.out(a, b);
35
- }
36
- """
37
-
38
- compare = """
39
- walker init {
40
- a = 5; b = 6;
41
- std.out(a == b,
42
- a != b,
43
- a < b,
44
- a > b,
45
- a <= b,
46
- a >= b,
47
- a == b-1);
48
- }
49
- """
50
-
51
- logical = """
52
- walker init {
53
- a = true; b = false;
54
- std.out(a,
55
- !a,
56
- a && b,
57
- a || b,
58
- a and b,
59
- a or b,
60
- !a or b,
61
- !(a and b));
62
- }
63
- """
64
-
65
- assignments = """
66
- walker init {
67
- a = 4 + 4; std.out(a);
68
- a += 4 + 4; std.out(a);
69
- a -= 4 * -5; std.out(a);
70
- a *= 4 / 4; std.out(a);
71
- a /= 4 - 6; std.out(a);
72
-
73
- # a := here; std.out(a);
74
- # Noting existence of copy assign, described later
75
- }
76
- """
77
-
78
- if_stmt = """
79
- walker init {
80
- a = 4; b = 5;
81
- if(a < b): std.out("Hello!");
82
- }
83
- """
84
-
85
- else_stmt = """
86
- walker init {
87
- a = 4; b = 5;
88
- if(a == b): std.out("A equals B");
89
- else: std.out("A is not equal to B");
90
- }
91
- """
92
-
93
- elif_stmt = """
94
- walker init {
95
- a = 4; b = 5;
96
- if(a == b): std.out("A equals B");
97
- elif(a > b): std.out("A is greater than B");
98
- elif(a == b - 1): std.out("A is one less than B");
99
- elif(a == b - 2): std.out("A is two less than B");
100
- else: std.out("A is something else");
101
- }
102
- """
103
-
104
- for_stmt = """
105
- walker init {
106
- for i=0 to i<10 by i+=1:
107
- std.out("Hello", i, "times!");
108
- }
109
- """
110
- while_stmt = """
111
- walker init {
112
- i = 5;
113
- while(i>0) {
114
- std.out("Hello", i, "times!");
115
- i -= 1;
116
- }
117
- }
118
- """
119
-
120
- break_stmt = """
121
- walker init {
122
- for i=0 to i<10 by i+=1 {
123
- std.out("Hello", i, "times!");
124
- if(i == 6): break;
125
- }
126
- }
127
- """
128
-
129
- continue_stmt = """
130
- walker init {
131
- i = 5;
132
- while(i>0) {
133
- if(i == 3){
134
- i -= 1; continue;
135
- }
136
- std.out("Hello", i, "times!");
137
- i -= 1;
138
- }
139
- }
140
- """
141
-
142
- continue_stmt2 = """
143
- walker init {
144
- z=10;
145
-
146
- while(z>=0){
147
- z-=1;
148
- if(z<5){
149
- continue;
150
- }
151
- std.out("hello", z);
152
- }
153
- }
154
- """
155
-
156
- destroy_disconn = """
157
- node testnode {
158
- has apple;
159
- }
160
-
161
- walker init{
162
- node1 = spawn here ++> node::testnode ;
163
- node2 = spawn here ++> node::testnode ;
164
- node1 ++> node2;
165
- std.out(-->);
166
- destroy node1;
167
- # All node destroys queue'd after walk
168
- # may not be a good idea, must think about it
169
- std.out(-->);
170
- here !--> node2;
171
- std.out('1', -->);
172
- }
173
- """
174
-
175
- array_assign = """
176
- node testnode {
177
- has apple;
178
- }
179
-
180
- walker init{
181
- root {
182
- node1 = spawn here ++> node::testnode ;
183
- node1.apple = [[1,2],[3,4]];
184
- take node1;
185
- }
186
- testnode {
187
- a = [[0,0],[0,0]];
188
- std.out(a);
189
- a[0] = [1,1];
190
- std.out(a);
191
- std.out(here.apple);
192
- here.apple[1] = here.apple[0];
193
- std.out(here.apple);
194
- }
195
- }
196
- """
197
-
198
- array_md_assign = """
199
- node testnode {
200
- has apple;
201
- }
202
-
203
- walker init{
204
- root {
205
- node1 = spawn here ++> node::testnode ;
206
- node1.apple = [[1,2],[3,4]];
207
- take node1;
208
- }
209
- testnode {
210
- std.out(here.apple);
211
- here.apple[0][1] = here.apple[0][0];
212
- std.out(here.apple);
213
- }
214
- }
215
- """
216
-
217
- dereference = """
218
- node testnode {
219
- has apple;
220
- }
221
-
222
- walker init{
223
- root {
224
- node1 = spawn here ++> node::testnode ;
225
- std.out(&node1);
226
- }
227
- }
228
- """
229
-
230
- pre_post_walking = """
231
- node testnode {
232
- has apple;
233
- }
234
-
235
- walker init {
236
- has count;
237
-
238
- with entry {
239
- count = 5;
240
- spawn here ++> node::testnode ;
241
- spawn here ++> node::testnode ;
242
- spawn here ++> node::testnode ;
243
- take -->;
244
- }
245
-
246
- testnode {
247
- count += 1;
248
- }
249
-
250
- with exit {std.out("count:",count);}
251
- }
252
- """
253
-
254
- pre_post_walking_dis = """
255
- node testnode {
256
- has apple;
257
- }
258
-
259
- walker init {
260
- has count;
261
-
262
- with entry {
263
- count = 5;
264
- spawn here ++> node::testnode ;
265
- spawn here ++> node::testnode ;
266
- spawn here ++> node::testnode ;
267
- take -->;
268
- }
269
-
270
- testnode {
271
- count += 1;
272
- disengage;
273
- std.out("test");
274
- }
275
-
276
- with exit {std.out("count:",count);}
277
- }
278
- """
279
-
280
- length = """
281
- node testnode {
282
- has apple;
283
- }
284
-
285
- walker init {
286
- spawn here ++> node::testnode ;
287
- spawn here ++> node::testnode ;
288
- spawn here ++> node::testnode ;
289
- std.out((-->).length);
290
- var = -->;
291
- std.out(var.length);
292
- }
293
- """
294
-
295
- sort_by_col = """
296
- walker init {
297
- lst=[['b', 333],['c',245],['a', 56]];
298
- std.out(lst);
299
- std.out(std.sort_by_col(lst, 0));
300
- std.out(std.sort_by_col(lst, 0, true));
301
- std.out(std.sort_by_col(lst, 1));
302
- std.out(std.sort_by_col(lst, 1, true));
303
- }
304
- """
305
-
306
- list_remove = """
307
- node testnode { has lst; }
308
-
309
- walker init {
310
- nd=spawn here ++> node::testnode ;
311
- nd.lst=[['b', 333],['c',245],['a', 56]];
312
- std.out(nd.lst);
313
- destroy nd.lst[1];
314
- std.out(nd.lst);
315
- destroy nd.lst[1];
316
- std.out(nd.lst);
317
- }
318
- """
319
-
320
- can_action = """
321
- node testnode {
322
- has anchor A;
323
- can ptest {
324
- b=7;
325
- std.out(A,b);
326
- ::ppp;
327
- }
328
- can ppp {
329
- b=8;
330
- std.out(A,b);
331
- }
332
- }
333
-
334
- walker init {
335
- a= spawn here ++> node::testnode (A=56);
336
- a::ptest;
337
- }
338
- """
339
-
340
- can_action_params = """
341
- node testnode {
342
- has anchor A;
343
- can ptest {
344
- b=7;
345
- std.out(A,b);
346
- ::ppp;
347
- }
348
- can ppp {
349
- b=8;
350
- std.out(A,b);
351
- }
352
- }
353
-
354
- walker init {
355
- a= spawn here ++> node::testnode (A=56);
356
- a::ptest(A=43);
357
- a::ptest(A=a.A+5);
358
- }
359
- """
360
-
361
- cross_scope_report = """
362
- node testnode {
363
- has anchor A;
364
- can ptest {
365
- b=7;
366
- std.out(A,b);
367
- report A;
368
- ::ppp;
369
- skip;
370
- std.out("shouldnt show this");
371
- }
372
- can ppp {
373
- b=8;
374
- std.out(A,b);
375
- report b;
376
- }
377
- }
378
-
379
- walker init {
380
- a= spawn here ++> node::testnode (A=56);
381
- a::ptest;
382
- report here;
383
- }
384
- """
385
-
386
- has_private = """
387
- node testnode {
388
- has apple;
389
- has private banana, grape;
390
- }
391
-
392
- walker init {
393
- root {
394
- spawn here ++> node::testnode (apple=5, banana=6, grape=1);
395
- take -->;
396
- }
397
- testnode {
398
- here.apple+=here.banana+here.grape;
399
- report here;
400
- }
401
- }
402
- """
403
-
404
- array_idx_of_expr = """
405
- node testnode {
406
- has apple;
407
- }
408
-
409
- walker init {
410
- spawn here ++> node::testnode ;
411
- spawn here ++> node::testnode ;
412
- spawn here ++> node::testnode ;
413
- std.out((-->).length);
414
- var = -->[0];
415
- std.out([var].length);
416
- }
417
- """
418
-
419
- dict_assign = """
420
- node testnode {
421
- has apple;
422
- }
423
-
424
- walker init{
425
- root {
426
- node1 = spawn here ++> node::testnode ;
427
- node1.apple = {"one": 1, "two": 2};
428
- take node1;
429
- }
430
- testnode {
431
- a = {"three": 3, "four": 4};
432
- std.out(a);
433
- a["four"] = 55;
434
- std.out(a);
435
- std.out(here.apple);
436
- here.apple["one"] = here.apple["two"];
437
- std.out(here.apple["one"]);
438
- }
439
- }
440
- """
441
-
442
- dict_md_assign = """
443
- node testnode {
444
- has apple;
445
- }
446
-
447
- walker init{
448
- root {
449
- node1 = spawn here ++> node::testnode ;
450
- node1.apple = {"one": {"inner": 44}, "two": 2};
451
- take node1;
452
- }
453
- testnode {
454
- std.out(here.apple);
455
- here.apple["one"]["inner"] = here.apple["two"];
456
- std.out(here.apple["one"]);
457
- std.out(here.apple["one"]['inner']);
458
- }
459
- }
460
- """
461
-
462
- dict_keys = """
463
- node testnode {
464
- has apple;
465
- }
466
-
467
- walker init{
468
- root {
469
- node1 = spawn here ++> node::testnode ;
470
- node1.apple = {"one": {"inner": 44}, "two": 2};
471
- take node1;
472
- }
473
- testnode {
474
- std.out(here.apple);
475
- for i in here.apple.keys:
476
- if(i == 'one'):
477
- for j in here.apple.keys:
478
- if(j == 'two'):
479
- here.apple[i]["inner"] = here.apple[j];
480
- std.out(here.apple["one"]);
481
- std.out(here.apple["one"]['inner']);
482
- }
483
- }
484
- """
485
- cond_dict_keys = """
486
- node testnode {
487
- has apple;
488
- }
489
-
490
- walker init{
491
- root {
492
- node1 = spawn here ++> node::testnode ;
493
- node1.apple = {"one": {"inner": 44}, "two": 2};
494
- take node1;
495
- }
496
- testnode {
497
- std.out(here.apple);
498
- if('one' in here.apple.keys) {std.out('is here');}
499
- if('three' not in here.apple.keys) {std.out('also not here'); }
500
- if('three' in here.apple.keys) {std.out('SHOULD NOT PRINT'); }
501
- }
502
- }
503
- """
504
-
505
- soft_max = """
506
- walker init{
507
- can vector.softmax;
508
- scores = [3.0, 1.0, 0.2];
509
- a=vector.softmax(scores);
510
- report a;
511
- std.out(a);
512
- }
513
- """
514
-
515
- fam_example = """
516
- node man;
517
- node woman;
518
-
519
- edge mom;
520
- edge dad;
521
- edge married;
522
-
523
- walker create_fam {
524
- root {
525
- spawn here ++> node::man;
526
- spawn here ++> node::woman;
527
- --> node::man <+[married]+> --> node::woman;
528
- take -->;
529
- }
530
- woman {
531
- son = spawn here <+[mom]+ node::man;
532
- son <+[dad]+ <-[married]->;
533
- }
534
- man {
535
- std.out("I didn't do any of the hard work.");
536
- }
537
- }
538
- """
539
-
540
- visitor_preset = """
541
- node person {
542
- has name;
543
- has byear;
544
- can date.quantize_to_year::std.time_now()::>byear with setter entry;
545
- can std.out::byear," from ",visitor.info:: with exit;
546
- can std.out::byear," init only from ",visitor.info:: with init exit;
547
- }
548
-
549
- walker init {
550
- has year=std.time_now();
551
- root {
552
- person1 = spawn here ++>
553
- node::person(name="Josh", byear="1995-01-01");
554
- take --> ;
555
- }
556
- person {
557
- spawn here walker::setter;
558
- }
559
- }
560
-
561
- walker setter {
562
- has year=std.time_now();
563
- }
564
- """
565
-
566
- visitor_local_aciton = """
567
- node person {
568
- has name;
569
- has byear;
570
- can set_year with setter entry {
571
- byear = visitor.year;
572
- }
573
- can print_out with exit {
574
- std.out(byear, " from ", visitor.info);
575
- }
576
- can reset { # <-- Could add 'with activity' for equivalent behavior
577
- byear = "1995-01-01";
578
- std.out("resetting year to 1995:", here.context);
579
- }
580
- }
581
-
582
- walker init {
583
- has year = std.time_now();
584
- has person1;
585
- root {
586
- person1 = spawn here ++> node::person;
587
- std.out(person1.context);
588
- person1::reset;
589
- take -->;
590
- }
591
- person {
592
- spawn here walker::setter;
593
- person1::reset(name="Joe");
594
- }
595
- }
596
-
597
- walker setter {
598
- has year = std.time_now();
599
- }
600
- """
601
-
602
- copy_assign_to_edge = """
603
- node person: has name, age, birthday, profession;
604
- edge friend: has meeting_place;
605
- edge family: has kind;
606
-
607
- walker init {
608
- person1 = spawn here +[friend(meeting_place = "college")]+>
609
- node::person(name = "Josh", age = 32);
610
- person2 = spawn here +[family(kind = "sister")]+>
611
- node::person(name = "Jane", age = 30);
612
-
613
- twin1 = spawn here +[friend]+> node::person;
614
- twin2 = spawn here +[family]+> node::person;
615
- twin1 := person1;
616
- twin2 := person2;
617
-
618
- -->.edge[2] := -->.edge[0];
619
- -->.edge[3] := -->.edge[1];
620
-
621
- std.out("Context for our people nodes and edges:");
622
- for i in -->: std.out(i.context, '\\n', i.edge[0].context);
623
- }
624
- """