summaryrefslogtreecommitdiff
path: root/yaksh/java_code_evaluator.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/java_code_evaluator.py')
-rw-r--r--yaksh/java_code_evaluator.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/yaksh/java_code_evaluator.py b/yaksh/java_code_evaluator.py
index e6dc628..55e6c9f 100644
--- a/yaksh/java_code_evaluator.py
+++ b/yaksh/java_code_evaluator.py
@@ -1,11 +1,8 @@
#!/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
-import importlib
# Local imports
from .base_evaluator import BaseEvaluator
@@ -62,8 +59,8 @@ class JavaCodeEvaluator(BaseEvaluator):
# create student code and moderator code file
self.submit_code_path = self.create_submit_code_file('Test.java')
self.test_code_path = self.create_submit_code_file('main.java')
- 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
@@ -78,11 +75,11 @@ class JavaCodeEvaluator(BaseEvaluator):
user_code_directory = os.getcwd() + '/'
ref_file_name = (clean_ref_code_path.split('/')[-1]).split('.')[0]
- self.user_output_path = self.set_file_paths(user_code_directory,
- 'Test'
+ self.user_output_path = self.set_file_paths(
+ user_code_directory, 'Test'
)
- self.ref_output_path = self.set_file_paths(user_code_directory,
- ref_file_name
+ self.ref_output_path = self.set_file_paths(
+ user_code_directory, ref_file_name
)
compile_command, self.compile_main = self.get_commands(
clean_ref_code_path,
@@ -93,13 +90,15 @@ class JavaCodeEvaluator(BaseEvaluator):
ref_file_name
)
- self.compiled_user_answer = self._run_command(compile_command,
+ self.compiled_user_answer = self._run_command(
+ compile_command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
- self.compiled_test_code = self._run_command(self.compile_main,
+ self.compiled_test_code = self._run_command(
+ self.compile_main,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
@@ -141,9 +140,9 @@ class JavaCodeEvaluator(BaseEvaluator):
if main_err == '':
ret = self._run_command(self.run_command_args, shell=True,
- 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