Spaces:
Runtime error
Runtime error
Experimenting with how I return results
Browse files452 unmodified lines453454455456457458459460151 unmodified lines6126136146156166176186196205 unmodified lines626627628629630631452 unmodified linesout_dict = dict(task_id=task_id,passed=result[-1] == "passed",result=result[0],completion_id=completion_id,)151 unmodified lineswith 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 linesresult.append(f"failed ({type(e)}): {str(e)}")result.append(e)# Needed for cleaning up.shutil.rmtree = rmtreeos.rmdir = rmdir452 unmodified lines453454455456457458459460151 unmodified lines6126136146156166175 unmodified lines623624625626627628629630631452 unmodified linesout_dict = dict(task_id=task_id,passed=result[0] == "passed",result=result,completion_id=completion_id,)151 unmodified lineswith time_limit(timeout):byte_code = compile_restricted(check_program, filename="<model output>", mode="exec", policy=policy_class)exec(byte_code, exec_globals, additional_locals)result.append("passed")5 unmodified linesresult.append(f"failed ({type(e)}): {str(e)}")result.append(e)if return_output and output_variable in additional_locals: # type: ignoreresult.append(additional_locals[output_variable]) # type: ignore# Needed for cleaning up.shutil.rmtree = rmtreeos.rmdir = rmdir
restrictedpython_code_eval.py+5-5