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

Function run_javascript_code

pygen/translated_code_eval.py:18–31  ·  view source on GitHub ↗
(js_code, input_data)

Source from the content-addressed store, hash-verified

16 return ""
17
18def run_javascript_code(js_code, input_data):
19 with open("temp.js", "w") as f:
20 f.write(js_code)
21 try:
22 process = subprocess.run(
23 ["node", "temp.js"],
24 input=input_data.encode(),
25 capture_output=True,
26 text=True,
27 )
28 return process.stdout.strip()
29 except Exception as e:
30 print(f"Error running JavaScript code: {str(e)}")
31 return ""
32
33def evaluate_translation(python_code, js_code, test_cases):
34 matches = 0

Callers 1

evaluate_translationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected