diff options
author | adityacp | 2016-07-11 16:37:50 +0530 |
---|---|---|
committer | adityacp | 2016-07-28 15:56:06 +0530 |
commit | df9a893b91b4adb39f01b88f6b6d96359db37f47 (patch) | |
tree | 550368dc971592f859928c5ba1ecc30d0debae53 /yaksh | |
parent | f84e26b203c77d4cf5c78860f43448a5858803c6 (diff) | |
download | online_test-df9a893b91b4adb39f01b88f6b6d96359db37f47.tar.gz online_test-df9a893b91b4adb39f01b88f6b6d96359db37f47.tar.bz2 online_test-df9a893b91b4adb39f01b88f6b6d96359db37f47.zip |
changed file module name in evaluators
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/bash_code_evaluator.py | 18 | ||||
-rw-r--r-- | yaksh/cpp_code_evaluator.py | 12 | ||||
-rw-r--r-- | yaksh/java_code_evaluator.py | 12 | ||||
-rw-r--r-- | yaksh/python_assertion_evaluator.py | 12 | ||||
-rw-r--r-- | yaksh/python_stdout_evaluator.py | 12 | ||||
-rw-r--r-- | yaksh/scilab_code_evaluator.py | 12 |
6 files changed, 31 insertions, 47 deletions
diff --git a/yaksh/bash_code_evaluator.py b/yaksh/bash_code_evaluator.py index c602ceb..bce7f07 100644 --- a/yaksh/bash_code_evaluator.py +++ b/yaksh/bash_code_evaluator.py @@ -9,7 +9,7 @@ import importlib # local imports from code_evaluator import CodeEvaluator -from copy_delete_files import CopyDeleteFiles +from file_utils import copy_files, delete_files class BashCodeEvaluator(CodeEvaluator): @@ -23,9 +23,8 @@ class BashCodeEvaluator(CodeEvaluator): # Delete the created file. super(BashCodeEvaluator, self).teardown() os.remove(self.submit_code_path) - if self.files_list: - file_delete = CopyDeleteFiles() - file_delete.delete_files(self.files_list) + if self.files: + delete_files(self.files) def check_code(self, user_answer, file_paths, test_case): """ Function validates student script using instructor script as @@ -57,10 +56,9 @@ class BashCodeEvaluator(CodeEvaluator): clean_ref_code_path, clean_test_case_path = \ self._set_test_code_file_path(get_ref_path, get_test_case_path) - self.files_list = [] + self.files = [] if file_paths: - file_copy = CopyDeleteFiles() - self.files_list = file_copy.copy_files(file_paths) + self.files = copy_files(file_paths) if not isfile(clean_ref_code_path): msg = "No file at %s or Incorrect path" % clean_ref_code_path return False, msg @@ -123,12 +121,8 @@ class BashCodeEvaluator(CodeEvaluator): stderr=subprocess.PIPE ) proc, inst_stdout, inst_stderr = ret - if self.files_list: - file_delete = CopyDeleteFiles() - file_delete.delete_files(self.files_list) if file_paths: - file_copy = CopyDeleteFiles() - self.files_list = file_copy.copy_files(file_paths) + self.files = copy_files(file_paths) args = [self.submit_code_path] + \ [x for x in test_case.split()] ret = self._run_command(args, diff --git a/yaksh/cpp_code_evaluator.py b/yaksh/cpp_code_evaluator.py index 29b24d5..c65242d 100644 --- a/yaksh/cpp_code_evaluator.py +++ b/yaksh/cpp_code_evaluator.py @@ -8,7 +8,7 @@ import importlib # local imports from code_evaluator import CodeEvaluator -from copy_delete_files import CopyDeleteFiles +from file_utils import copy_files, delete_files class CppCodeEvaluator(CodeEvaluator): @@ -27,9 +27,8 @@ class CppCodeEvaluator(CodeEvaluator): os.remove(self.ref_output_path) if os.path.exists(self.user_output_path): os.remove(self.user_output_path) - if self.files_list: - file_delete = CopyDeleteFiles() - file_delete.delete_files(self.files_list) + if self.files: + delete_files(self.files) def set_file_paths(self): user_output_path = os.getcwd() + '/output' @@ -47,7 +46,7 @@ class CppCodeEvaluator(CodeEvaluator): return compile_command, compile_main def compile_code(self, user_answer, file_paths, test_case): - self.files_list = [] + self.files = [] if self.compiled_user_answer and self.compiled_test_code: return None else: @@ -55,8 +54,7 @@ class CppCodeEvaluator(CodeEvaluator): clean_ref_code_path, clean_test_case_path = \ self._set_test_code_file_path(ref_code_path) if file_paths: - file_copy = CopyDeleteFiles() - self.files_list = file_copy.copy_files(file_paths) + self.files = copy_files(file_paths) if not isfile(clean_ref_code_path): msg = "No file at %s or Incorrect path" % clean_ref_code_path return False, msg diff --git a/yaksh/java_code_evaluator.py b/yaksh/java_code_evaluator.py index dde2ec2..ff76317 100644 --- a/yaksh/java_code_evaluator.py +++ b/yaksh/java_code_evaluator.py @@ -8,7 +8,7 @@ import importlib # local imports from code_evaluator import CodeEvaluator -from copy_delete_files import CopyDeleteFiles +from file_utils import copy_files, delete_files class JavaCodeEvaluator(CodeEvaluator): @@ -27,9 +27,8 @@ class JavaCodeEvaluator(CodeEvaluator): os.remove(self.user_output_path) if os.path.exists(self.ref_output_path): os.remove(self.ref_output_path) - if self.files_list: - file_delete = CopyDeleteFiles() - file_delete.delete_files(self.files_list) + if self.files: + delete_files(self.files) def get_commands(self, clean_ref_code_path, user_code_directory): compile_command = 'javac {0}'.format(self.submit_code_path), @@ -44,7 +43,7 @@ class JavaCodeEvaluator(CodeEvaluator): return output_path def compile_code(self, user_answer, file_paths, test_case): - self.files_list = [] + self.files = [] if self.compiled_user_answer and self.compiled_test_code: return None else: @@ -52,8 +51,7 @@ class JavaCodeEvaluator(CodeEvaluator): clean_ref_code_path, clean_test_case_path = \ self._set_test_code_file_path(ref_code_path) if file_paths: - file_copy = CopyDeleteFiles() - self.files_list = file_copy.copy_files(file_paths) + self.files = copy_files(file_paths) if not isfile(clean_ref_code_path): msg = "No file at %s or Incorrect path" % clean_ref_code_path return False, msg diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 3e98f08..04a4e69 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -7,7 +7,7 @@ import importlib # local imports from code_evaluator import CodeEvaluator, TimeoutException -from copy_delete_files import CopyDeleteFiles +from file_utils import copy_files, delete_files class PythonAssertionEvaluator(CodeEvaluator): @@ -20,15 +20,13 @@ class PythonAssertionEvaluator(CodeEvaluator): def teardown(self): super(PythonAssertionEvaluator, self).teardown() # Delete the created file. - if self.files_list: - file_delete = CopyDeleteFiles() - file_delete.delete_files(self.files_list) + if self.files: + delete_files(self.files) def compile_code(self, user_answer, file_paths, test_case): - self.files_list = [] + self.files = [] if file_paths: - file_copy = CopyDeleteFiles() - self.files_list = file_copy.copy_files(file_paths) + self.files = copy_files(file_paths) if self.exec_scope: return None else: diff --git a/yaksh/python_stdout_evaluator.py b/yaksh/python_stdout_evaluator.py index fa8d6c6..8f69b24 100644 --- a/yaksh/python_stdout_evaluator.py +++ b/yaksh/python_stdout_evaluator.py @@ -8,7 +8,7 @@ from contextlib import contextmanager # local imports from code_evaluator import CodeEvaluator -from copy_delete_files import CopyDeleteFiles +from file_utils import copy_files, delete_files @contextmanager @@ -29,15 +29,13 @@ class PythonStdoutEvaluator(CodeEvaluator): def teardown(self): super(PythonStdoutEvaluator, self).teardown() # Delete the created file. - if self.files_list: - file_delete = CopyDeleteFiles() - file_delete.delete_files(self.files_list) + if self.files: + delete_files(self.files) def compile_code(self, user_answer, file_paths, expected_output): - self.files_list = [] + self.files = [] if file_paths: - file_copy = CopyDeleteFiles() - self.files_list = file_copy.copy_files(file_paths) + self.files = copy_files(file_paths) if hasattr(self, 'output_value'): return None else: diff --git a/yaksh/scilab_code_evaluator.py b/yaksh/scilab_code_evaluator.py index 5f38087..53fa343 100644 --- a/yaksh/scilab_code_evaluator.py +++ b/yaksh/scilab_code_evaluator.py @@ -8,7 +8,7 @@ import importlib # local imports from code_evaluator import CodeEvaluator -from copy_delete_files import CopyDeleteFiles +from file_utils import copy_files, delete_files class ScilabCodeEvaluator(CodeEvaluator): @@ -22,15 +22,13 @@ class ScilabCodeEvaluator(CodeEvaluator): super(ScilabCodeEvaluator, self).teardown() # Delete the created file. os.remove(self.submit_code_path) - if self.files_list: - file_delete = CopyDeleteFiles() - file_delete.delete_files(self.files_list) + if self.files: + delete_files(self.files) def check_code(self, user_answer, file_paths, test_case): - self.files_list = [] + self.files = [] if file_paths: - file_copy = CopyDeleteFiles() - self.files_list = file_copy.copy_files(file_paths) + self.files = copy_files(file_paths) ref_code_path = test_case clean_ref_path, clean_test_case_path = \ self._set_test_code_file_path(ref_code_path) |