summaryrefslogtreecommitdiff
path: root/yaksh/java_code_evaluator.py
diff options
context:
space:
mode:
authoradityacp2018-05-24 12:07:39 +0530
committeradityacp2018-06-07 14:50:47 +0530
commit97b657edc2a323f832c81f0e34ce5761bd21f7e9 (patch)
tree09f4367f813fab99ffa8cd540d246cfc8c8fa00a /yaksh/java_code_evaluator.py
parent78ce1804d3a82327aa0da1510bb5c03d6bbff3ba (diff)
downloadonline_test-97b657edc2a323f832c81f0e34ce5761bd21f7e9.tar.gz
online_test-97b657edc2a323f832c81f0e34ce5761bd21f7e9.tar.bz2
online_test-97b657edc2a323f832c81f0e34ce5761bd21f7e9.zip
Pep8 changes
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