Spaces:
Runtime error
Runtime error
Experimenting with how I return results
Browse files452 unmodified lines453454455456457456457458459460151 unmodified lines6126136146156166176156166175 unmodified lines623624625626627628629630631452 unmodified lines
out_dict = dict( task_id=task_id, passed=result[-1] == "passed", result=result[0], passed=result[0] == "passed", result=result, completion_id=completion_id, )
151 unmodified lines with time_limit(timeout): byte_code = compile_restricted(check_program, filename="<model output>", mode="exec", policy=policy_class) exec(byte_code, exec_globals, additional_locals)
if return_output: result.append(additional_locals[output_variable]) result.append("passed")
5 unmodified lines result.append(f"failed ({type(e)}): {str(e)}") result.append(e)
if return_output and output_variable in additional_locals: # type: ignore result.append(additional_locals[output_variable]) # type: ignore
# Needed for cleaning up. shutil.rmtree = rmtree os.rmdir = rmdirrestrictedpython_code_eval.py+5-5