MCPcopy Create free account
hub / github.com/GitsSaikat/PyGen / run_python_code

Function run_python_code

pygen/translated_code_eval.py:5–16  ·  view source on GitHub ↗
(python_code, input_data)

Source from the content-addressed store, hash-verified

3import random
4
5def run_python_code(python_code, input_data):
6 try:
7 process = subprocess.run(
8 ["python", "-c", python_code],
9 input=input_data.encode(),
10 capture_output=True,
11 text=True,
12 )
13 return process.stdout.strip()
14 except Exception as e:
15 print(f"Error running Python code: {str(e)}")
16 return ""
17
18def run_javascript_code(js_code, input_data):
19 with open("temp.js", "w") as f:

Callers 1

evaluate_translationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected