From fd97b0391b7364927061487604b187541dab6510 Mon Sep 17 00:00:00 2001 From: adityacp Date: Mon, 20 Jun 2016 14:55:08 +0530 Subject: changed evaluators to support file based questions --- yaksh/scilab_code_evaluator.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'yaksh/scilab_code_evaluator.py') diff --git a/yaksh/scilab_code_evaluator.py b/yaksh/scilab_code_evaluator.py index 91b4cb3..5f38087 100644 --- a/yaksh/scilab_code_evaluator.py +++ b/yaksh/scilab_code_evaluator.py @@ -8,6 +8,7 @@ import importlib # local imports from code_evaluator import CodeEvaluator +from copy_delete_files import CopyDeleteFiles class ScilabCodeEvaluator(CodeEvaluator): @@ -21,8 +22,15 @@ 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) - def check_code(self, user_answer, test_case): + def check_code(self, user_answer, file_paths, test_case): + self.files_list = [] + if file_paths: + file_copy = CopyDeleteFiles() + self.files_list = file_copy.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) @@ -60,7 +68,6 @@ class ScilabCodeEvaluator(CodeEvaluator): err = add_err + stdout else: err = add_err + stderr - return success, err def _remove_scilab_exit(self, string): -- cgit From df9a893b91b4adb39f01b88f6b6d96359db37f47 Mon Sep 17 00:00:00 2001 From: adityacp Date: Mon, 11 Jul 2016 16:37:50 +0530 Subject: changed file module name in evaluators --- yaksh/scilab_code_evaluator.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'yaksh/scilab_code_evaluator.py') 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) -- cgit