summaryrefslogtreecommitdiff
path: root/yaksh/cpp_code_evaluator.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/cpp_code_evaluator.py')
-rw-r--r--yaksh/cpp_code_evaluator.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/yaksh/cpp_code_evaluator.py b/yaksh/cpp_code_evaluator.py
index 4c8e938..aab4995 100644
--- a/yaksh/cpp_code_evaluator.py
+++ b/yaksh/cpp_code_evaluator.py
@@ -1,9 +1,7 @@
#!/usr/bin/env python
from __future__ import unicode_literals
-import traceback
-import pwd
import os
-from os.path import join, isfile
+from os.path import isfile
import subprocess
# Local imports
@@ -51,12 +49,13 @@ class CppCodeEvaluator(BaseEvaluator):
return user_output_path, ref_output_path
def get_commands(self, clean_ref_code_path, user_output_path,
- ref_output_path):
- compile_command = 'g++ {0} -c -o {1}'.format(self.submit_code_path,
- user_output_path)
- compile_main = 'g++ {0} {1} -o {2}'.format(clean_ref_code_path,
- user_output_path,
- ref_output_path)
+ ref_output_path):
+ compile_command = 'g++ {0} -c -o {1}'.format(
+ self.submit_code_path, user_output_path)
+ compile_main = 'g++ {0} {1} -o {2}'.format(
+ clean_ref_code_path, user_output_path,
+ ref_output_path
+ )
return compile_command, compile_main
def compile_code(self):
@@ -65,7 +64,8 @@ class CppCodeEvaluator(BaseEvaluator):
else:
self.submit_code_path = self.create_submit_code_file('submit.c')
self.test_code_path = self.create_submit_code_file('main.c')
- self.write_to_submit_code_file(self.submit_code_path, self.user_answer)
+ self.write_to_submit_code_file(self.submit_code_path,
+ self.user_answer)
self.write_to_submit_code_file(self.test_code_path, self.test_case)
clean_ref_code_path = self.test_code_path
if self.file_paths:
@@ -132,10 +132,10 @@ class CppCodeEvaluator(BaseEvaluator):
if main_err == '':
ret = self._run_command([self.ref_output_path],
- stdin=None,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE
- )
+ stdin=None,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE
+ )
proc, stdout, stderr = ret
if proc.returncode == 0:
success, err = True, None