|
@@ -2,12 +2,6 @@ import time as python_time
|
|
|
import json
|
|
|
import sys
|
|
|
|
|
|
-class PrimitiveFinished(Exception):
|
|
|
- """Exception to indicate the result value of a primitive, as a return cannot be used."""
|
|
|
- def __init__(self, value):
|
|
|
- Exception.__init__(self)
|
|
|
- self.result = value
|
|
|
-
|
|
|
class InterpretedFunctionFinished(Exception):
|
|
|
"""Exception to indicate the result value of an interpreted function, as a return
|
|
|
cannot be used."""
|
|
@@ -23,7 +17,6 @@ class SleepKernel(Exception):
|
|
|
self.interruptable = interruptable
|
|
|
|
|
|
# Functions annotated with __exception_return use the JIT's calling convention instead of
|
|
|
-# the kernel's: returns are handled by throwing a PrimitiveFinished exception; the caller's
|
|
|
# returnvalue is not modified.
|
|
|
#
|
|
|
# ### Rationale for __exception_return
|
|
@@ -46,7 +39,6 @@ def integer_subtraction(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] - b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] - b['value']}])]
|
|
|
|
|
|
def integer_addition(a, b, **remainder):
|
|
@@ -54,7 +46,6 @@ def integer_addition(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] + b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] + b['value']}])]
|
|
|
|
|
|
def integer_multiplication(a, b, **remainder):
|
|
@@ -62,7 +53,6 @@ def integer_multiplication(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] * b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] * b['value']}])]
|
|
|
|
|
|
def integer_division(a, b, **remainder):
|
|
@@ -70,7 +60,6 @@ def integer_division(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': int(a['value']) // b['value']})
|
|
|
yield [("RETURN", [{'value': int(a['value']) // b['value']}])]
|
|
|
|
|
|
def integer_lt(a, b, **remainder):
|
|
@@ -78,7 +67,6 @@ def integer_lt(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] < b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] < b['value']}])]
|
|
|
|
|
|
def bool_and(a, b, **remainder):
|
|
@@ -86,7 +74,6 @@ def bool_and(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] and b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] and b['value']}])]
|
|
|
|
|
|
def bool_or(a, b, **remainder):
|
|
@@ -94,13 +81,11 @@ def bool_or(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] or b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] or b['value']}])]
|
|
|
|
|
|
def bool_not(a, **remainder):
|
|
|
if 'value' not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': not a['value']})
|
|
|
yield [("RETURN", [{'value': not a['value']}])]
|
|
|
|
|
|
def float_subtraction(a, b, **remainder):
|
|
@@ -108,7 +93,6 @@ def float_subtraction(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] - b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] - b['value']}])]
|
|
|
|
|
|
def float_addition(a, b, **remainder):
|
|
@@ -116,7 +100,6 @@ def float_addition(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] + b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] + b['value']}])]
|
|
|
|
|
|
def float_multiplication(a, b, **remainder):
|
|
@@ -124,7 +107,6 @@ def float_multiplication(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] * b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] * b['value']}])]
|
|
|
|
|
|
def float_division(a, b, **remainder):
|
|
@@ -132,7 +114,6 @@ def float_division(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': float(a['value']) / float(b['value'])})
|
|
|
yield [("RETURN", [{'value': float(a['value']) / b['value']}])]
|
|
|
|
|
|
def float_lt(a, b, **remainder):
|
|
@@ -140,7 +121,6 @@ def float_lt(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] < b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] < b['value']}])]
|
|
|
|
|
|
def string_join(a, b, **remainder):
|
|
@@ -148,7 +128,6 @@ def string_join(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': str(a['value']) + str(b['value'])})
|
|
|
yield [("RETURN", [{'value': str(a['value']) + str(b['value'])}])]
|
|
|
|
|
|
def string_split(a, b, **remainder):
|
|
@@ -161,7 +140,6 @@ def string_split(a, b, **remainder):
|
|
|
elems = yield [("CN", [])] + [("CNV", [v]) for v in result]
|
|
|
new_val = elems[0]
|
|
|
yield [("CD", [new_val, i, v]) for i, v in enumerate(elems[1:])]
|
|
|
- #raise PrimitiveFinished({'id': new_val})
|
|
|
yield [("RETURN", [{'id': new_val}])]
|
|
|
|
|
|
def string_get(a, b, **remainder):
|
|
@@ -169,13 +147,11 @@ def string_get(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'][b['value']]})
|
|
|
yield [("RETURN", [{'value': a['value'][b['value']]}])]
|
|
|
|
|
|
def string_len(a, **remainder):
|
|
|
if 'value' not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': len(a['value'])})
|
|
|
yield [("RETURN", [{'value': len(a['value'])}])]
|
|
|
|
|
|
def value_eq(a, b, **remainder):
|
|
@@ -183,7 +159,6 @@ def value_eq(a, b, **remainder):
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if 'value' not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value'] == b['value']})
|
|
|
yield [("RETURN", [{'value': a['value'] == b['value']}])]
|
|
|
|
|
|
def element_eq(a, b, **remainder):
|
|
@@ -193,52 +168,43 @@ def element_eq(a, b, **remainder):
|
|
|
if "id" not in b:
|
|
|
#print("MATERIALIZING B element_eq")
|
|
|
b['id'], = yield [("CNV", [b['value']])]
|
|
|
- #raise PrimitiveFinished({'value': a['id'] == b['id']})
|
|
|
yield [("RETURN", [{'value': a['id'] == b['id']}])]
|
|
|
|
|
|
def cast_string(a, **remainder):
|
|
|
if 'value' not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if isinstance(a['value'], dict):
|
|
|
- #raise PrimitiveFinished({'value': str(a['value']['value'])})
|
|
|
yield [("RETURN", [{'value': str(a['value']['value'])}])]
|
|
|
else:
|
|
|
- #raise PrimitiveFinished({'value': str(a['value'])})
|
|
|
yield [("RETURN", [{'value': str(a['value'])}])]
|
|
|
|
|
|
def cast_float(a, **remainder):
|
|
|
if 'value' not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': float(a['value'])})
|
|
|
yield [("RETURN", [{'value': float(a['value'])}])]
|
|
|
|
|
|
def cast_boolean(a, **remainder):
|
|
|
if 'value' not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': bool(a['value'])})
|
|
|
yield [("RETURN", [{'value': bool(a['value'])}])]
|
|
|
|
|
|
def cast_integer(a, **remainder):
|
|
|
if 'value' not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': int(a['value'])})
|
|
|
yield [("RETURN", [{'value': int(a['value'])}])]
|
|
|
|
|
|
def cast_value(a, **remainder):
|
|
|
if 'value' not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
if isinstance(a['value'], dict):
|
|
|
- #raise PrimitiveFinished({'value': str(a['value']['value'])})
|
|
|
yield [("RETURN", [{'value': str(a['value']['value'])}])]
|
|
|
else:
|
|
|
- #raise PrimitiveFinished({'value': json.dumps(a['value'])})
|
|
|
yield [("RETURN", [{'value': json.dumps(a['value'])}])]
|
|
|
|
|
|
def cast_id(a, **remainder):
|
|
|
if "id" not in a:
|
|
|
#print("MATERIALIZING A cast_id")
|
|
|
a['id'], = yield [("CNV", [a['value']])]
|
|
|
- #raise PrimitiveFinished({'value': str(a['id'])})
|
|
|
yield [("RETURN", [{'value': str(a['id'])}])]
|
|
|
|
|
|
def dict_add_fast(a, b, c, **remainder):
|
|
@@ -250,7 +216,6 @@ def dict_add_fast(a, b, c, **remainder):
|
|
|
c['id'], = yield [("CNV", [c['value']])]
|
|
|
|
|
|
yield [("CD", [a['id'], b['value'], c['id']])]
|
|
|
- #raise PrimitiveFinished(a)
|
|
|
yield [("RETURN", [a])]
|
|
|
|
|
|
def dict_delete(a, b, **remainder):
|
|
@@ -265,7 +230,6 @@ def dict_delete(a, b, **remainder):
|
|
|
print("Keys: " + str(keys))
|
|
|
raise Exception()
|
|
|
yield [("DE", [edge])]
|
|
|
- #raise PrimitiveFinished(a)
|
|
|
yield [("RETURN", [a])]
|
|
|
|
|
|
def dict_delete_node(a, b, **remainder):
|
|
@@ -273,98 +237,81 @@ def dict_delete_node(a, b, **remainder):
|
|
|
if edge is None:
|
|
|
print("Failed dict_delete_node!")
|
|
|
yield [("DE", [edge])]
|
|
|
- #raise PrimitiveFinished(a)
|
|
|
yield [("RETURN", [a])]
|
|
|
|
|
|
def dict_read(a, b, **remainder):
|
|
|
if "value" not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
result, = yield [("RD", [a['id'], b['value']])]
|
|
|
- #raise PrimitiveFinished({'id': result})
|
|
|
yield [("RETURN", [{'id': result}])]
|
|
|
|
|
|
def dict_read_edge(a, b, **remainder):
|
|
|
if "value" not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
result, = yield [("RDE", [a['id'], b['value']])]
|
|
|
- #raise PrimitiveFinished({'id': result})
|
|
|
yield [("RETURN", [{'id': result}])]
|
|
|
|
|
|
def dict_read_node(a, b, **remainder):
|
|
|
result, = yield [("RDN", [a['id'], b['id']])]
|
|
|
- #raise PrimitiveFinished({'id': result})
|
|
|
yield [("RETURN", [{'id': result}])]
|
|
|
|
|
|
def dict_in(a, b, **remainder):
|
|
|
if "value" not in b:
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
value, = yield [("RD", [a['id'], b['value']])]
|
|
|
- #raise PrimitiveFinished({'value': value is not None})
|
|
|
yield [("RETURN", [{'value': value is not None}])]
|
|
|
|
|
|
def dict_in_node(a, b, **remainder):
|
|
|
if "id" not in b:
|
|
|
# Not even allocated the node, so it is certain not to be in the dictionary
|
|
|
- #raise PrimitiveFinished({'value': False})
|
|
|
yield [("RETURN", [{'value': False}])]
|
|
|
value, = yield [("RDN", [a['id'], b['id']])]
|
|
|
- #raise PrimitiveFinished({'value': value is not None})
|
|
|
yield [("RETURN", [{'value': value is not None}])]
|
|
|
|
|
|
def dict_keys(a, **remainder):
|
|
|
keys, result = yield [("RDK", [a['id']]), ("CN", [])]
|
|
|
edges = yield [("CE", [result, result]) for _ in keys]
|
|
|
_ = yield [("CE", [edge, key]) for edge, key in zip(edges, keys)]
|
|
|
- #raise PrimitiveFinished({'id': result})
|
|
|
yield [("RETURN", [{'id': result}])]
|
|
|
|
|
|
def is_physical_int(a, **remainder):
|
|
|
if "value" not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
try:
|
|
|
- #raise PrimitiveFinished({'value': isinstance(a['value'], int) or isinstance(a['value'], long)})
|
|
|
yield [("RETURN", [{'value': isinstance(a['value'], int) or isinstance(a['value'], long)}])]
|
|
|
except NameError:
|
|
|
- #raise PrimitiveFinished({'value': isinstance(a['value'], int)})
|
|
|
yield [("RETURN", [{'value': isinstance(a['value'], int)}])]
|
|
|
|
|
|
def is_physical_string(a, **remainder):
|
|
|
if "value" not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
try:
|
|
|
- #raise PrimitiveFinished({'value': isinstance(a['value'], str) or isinstance(a['value'], unicode)})
|
|
|
yield [("RETURN", [{'value': isinstance(a['value'], str) or isinstance(a['value'], unicode)}])]
|
|
|
except NameError:
|
|
|
- #raise PrimitiveFinished({'value': isinstance(a['value'], str)})
|
|
|
yield [("RETURN", [{'value': isinstance(a['value'], str)}])]
|
|
|
|
|
|
def is_physical_float(a, **remainder):
|
|
|
if "value" not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': isinstance(a['value'], float)})
|
|
|
yield [("RETURN", [{'value': isinstance(a['value'], float)}])]
|
|
|
|
|
|
def is_physical_boolean(a, **remainder):
|
|
|
if "value" not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': isinstance(a['value'], bool)})
|
|
|
yield [("RETURN", [{'value': isinstance(a['value'], bool)}])]
|
|
|
|
|
|
def is_physical_action(a, **remainder):
|
|
|
if "value" not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': isinstance(a['value'], dict) and a['value']["value"] in ["if", "while", "assign", "call", "break", "continue", "return", "resolve", "access", "constant", "global", "declare"]})
|
|
|
yield [("RETURN", [{'value': isinstance(a['value'], dict) and a['value']["value"] in ["if", "while", "assign", "call", "break", "continue", "return", "resolve", "access", "constant", "global", "declare"]}])]
|
|
|
|
|
|
def is_physical_none(a, **remainder):
|
|
|
if "value" not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': isinstance(a['value'], dict) and a['value']["value"] == "none"})
|
|
|
yield [("RETURN", [{'value': isinstance(a['value'], dict) and a['value']["value"] == "none"}])]
|
|
|
|
|
|
def create_node(**remainder):
|
|
|
result, = yield [("CN", [])]
|
|
|
- #raise PrimitiveFinished({'id': result})
|
|
|
yield [("RETURN", [{'id': result}])]
|
|
|
|
|
|
def create_edge(a, b, **remainder):
|
|
@@ -375,20 +322,17 @@ def create_edge(a, b, **remainder):
|
|
|
#print("MATERIALIZING B create_edge")
|
|
|
b['id'], = yield [("CNV", [b['value']])]
|
|
|
result, = yield [("CE", [a['id'], b['id']])]
|
|
|
- #raise PrimitiveFinished({'id': result})
|
|
|
yield [("RETURN", [{'id': result}])]
|
|
|
|
|
|
def create_value(a, **remainder):
|
|
|
if "value" not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': a['value']})
|
|
|
yield [("RETURN", [{'value': a['value']}])]
|
|
|
|
|
|
def read_nr_out(a, **remainder):
|
|
|
if "id" not in a:
|
|
|
a['id'], = yield [("CNV", [a['value']])]
|
|
|
outgoing, = yield [("RO", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': len(outgoing)})
|
|
|
yield [("RETURN", [{'value': len(outgoing)}])]
|
|
|
|
|
|
def read_out(a, b, root, **remainder):
|
|
@@ -398,14 +342,12 @@ def read_out(a, b, root, **remainder):
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
|
|
|
outgoing, = yield [("RO", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'id': sorted(outgoing)[b['value']] if len(outgoing) > b['value'] else root})
|
|
|
yield [("RETURN", [{'id': sorted(outgoing)[b['value']] if len(outgoing) > b['value'] else root}])]
|
|
|
|
|
|
def read_nr_in(a, **remainder):
|
|
|
if "id" not in a:
|
|
|
a['id'], = yield [("CNV", [a['value']])]
|
|
|
incoming, = yield [("RI", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': len(incoming)})
|
|
|
yield [("RETURN", [{'value': len(incoming)}])]
|
|
|
|
|
|
def read_in(a, b, root, **remainder):
|
|
@@ -415,61 +357,49 @@ def read_in(a, b, root, **remainder):
|
|
|
b['value'], = yield [("RV", [b['id']])]
|
|
|
|
|
|
incoming, = yield [("RI", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'id': sorted(incoming)[b['value']] if len(incoming) > b['value'] else root})
|
|
|
yield [("RETURN", [{'id': sorted(incoming)[b['value']] if len(incoming) > b['value'] else root}])]
|
|
|
|
|
|
def read_edge_src(a, **remainder):
|
|
|
result, = yield [("RE", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'id': result[0]})
|
|
|
yield [("RETURN", [{'id': result[0]}])]
|
|
|
|
|
|
def read_edge_dst(a, **remainder):
|
|
|
result, = yield [("RE", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'id': result[1]})
|
|
|
yield [("RETURN", [{'id': result[1]}])]
|
|
|
|
|
|
def delete_element(a, **remainder):
|
|
|
if "id" not in a:
|
|
|
- #raise PrimitiveFinished({'value': False})
|
|
|
yield [("RETURN", [{'value': False}])]
|
|
|
|
|
|
edge, = yield [("RE", [a['id']])]
|
|
|
if edge[0] is None:
|
|
|
# Not an edge:
|
|
|
yield [("DN", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': False})
|
|
|
yield [("RETURN", [{'value': False}])]
|
|
|
else:
|
|
|
yield [("DE", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': True})
|
|
|
yield [("RETURN", [{'value': True}])]
|
|
|
|
|
|
def read_root(root, **remainder):
|
|
|
- #raise PrimitiveFinished({'id': root})
|
|
|
yield [("RETURN", [{'id': root}])]
|
|
|
|
|
|
def is_edge(a, **remainder):
|
|
|
if "id" not in a:
|
|
|
- #raise PrimitiveFinished({'value': False})
|
|
|
yield [("RETURN", [{'value': False}])]
|
|
|
|
|
|
edge, = yield [("RE", [a['id']])]
|
|
|
- #raise PrimitiveFinished({'value': edge[0] is not None})
|
|
|
yield [("RETURN", [{'value': edge[0] is not None}])]
|
|
|
|
|
|
def log(a, **remainder):
|
|
|
if "value" not in a:
|
|
|
a['value'], = yield [("RV", [a['id']])]
|
|
|
print("== LOG == " + str(a['value']))
|
|
|
- #raise PrimitiveFinished(a)
|
|
|
yield [("RETURN", [a])]
|
|
|
|
|
|
def read_taskroot(task_root, **remainder):
|
|
|
- #raise PrimitiveFinished({'id': task_root})
|
|
|
yield [("RETURN", [{'id': task_root}])]
|
|
|
|
|
|
def time(**remainder):
|
|
|
- #raise PrimitiveFinished({'value': python_time.time()})
|
|
|
yield [("RETURN", [{'value': python_time.time()}])]
|
|
|
|
|
|
def hash(a, **remainder):
|
|
@@ -481,7 +411,6 @@ def hash(a, **remainder):
|
|
|
value = hashlib.sha512(a['value']).hexdigest()
|
|
|
except TypeError:
|
|
|
value = hashlib.sha512(a['value'].encode()).hexdigest()
|
|
|
- #raise PrimitiveFinished({'value': value})
|
|
|
yield [("RETURN", [{'value': value}])]
|
|
|
|
|
|
def __sleep(a, b, **remainder):
|
|
@@ -492,13 +421,10 @@ def __sleep(a, b, **remainder):
|
|
|
timeout = a['value']
|
|
|
interruptable = b['value']
|
|
|
yield [("SLEEP", [timeout, interruptable])]
|
|
|
- #raise PrimitiveFinished(a)
|
|
|
yield [("RETURN", [a])]
|
|
|
|
|
|
def is_error(a, **remainder):
|
|
|
if a['id'] is None:
|
|
|
- #raise PrimitiveFinished({'value': True})
|
|
|
yield [("RETURN", [{'value': True}])]
|
|
|
else:
|
|
|
- #raise PrimitiveFinished({'value': False})
|
|
|
yield [("RETURN", [{'value': False}])]
|