def calculate_function(traversal, howcall=None): if howcall is None: howcall = traversal.specific_invocation_params.get("howcall") if howcall is None: howcall = interpret.HowCall.SINGLE global_namespace = traversal.global_invocation_options.global_options[ "global_namespace"].copy() if "exec_before" in traversal.specific_invocation_params["parameters"]: global_namespace.update( interpret.build_global_namespace( traversal.specific_invocation_params["parameters"] ["exec_before"])) if "code" in traversal.specific_invocation_params: return { "function": interpret.build_function( traversal.specific_invocation_params["code"], global_namespace=global_namespace, howcall=howcall, ) } return {"function": None}
def calculate_reduce(traversal): function = interpret.build_function( traversal.specific_invocation_params["code"], traversal.global_invocation_options.global_options["global_namespace"], howcall=interpret.HowCall.VARARGS, ) return {"function": function}