summaryrefslogtreecommitdiff
path: root/yaksh/scilab_code_evaluator.py
diff options
context:
space:
mode:
authorankitjavalkar2016-05-02 11:52:58 +0530
committerankitjavalkar2016-05-05 19:24:54 +0530
commit23b7abd3c1125e4c875e214e4f673c48c4bf4752 (patch)
treea76fccd392e054f33a3fc4bbd388c0aaa34bb40b /yaksh/scilab_code_evaluator.py
parentb40b668bcecd01b3c7f9f16b87775770ba06a33a (diff)
downloadonline_test-23b7abd3c1125e4c875e214e4f673c48c4bf4752.tar.gz
online_test-23b7abd3c1125e4c875e214e4f673c48c4bf4752.tar.bz2
online_test-23b7abd3c1125e4c875e214e4f673c48c4bf4752.zip
Remove commented code and cleanup
Diffstat (limited to 'yaksh/scilab_code_evaluator.py')
-rw-r--r--yaksh/scilab_code_evaluator.py68
1 files changed, 0 insertions, 68 deletions
diff --git a/yaksh/scilab_code_evaluator.py b/yaksh/scilab_code_evaluator.py
index fedfab3..3af9782 100644
--- a/yaksh/scilab_code_evaluator.py
+++ b/yaksh/scilab_code_evaluator.py
@@ -12,16 +12,6 @@ from code_evaluator import CodeEvaluator
class ScilabCodeEvaluator(CodeEvaluator):
"""Tests the Scilab code obtained from Code Server"""
- # def __init__(self, test_case_data, test, language, user_answer,
- # ref_code_path=None, in_dir=None):
- # super(ScilabCodeEvaluator, self).__init__(test_case_data, test,
- # language, user_answer,
- # ref_code_path, in_dir)
-
- # # Removes all the commands that terminates scilab
- # self.user_answer, self.terminate_commands = self._remove_scilab_exit(user_answer.lstrip())
- # self.test_case_args = self.setup()
-
def setup(self):
super(ScilabCodeEvaluator, self).setup()
# ref_path, test_case_path = self._set_test_code_file_path(self.ref_code_path)
@@ -33,30 +23,6 @@ class ScilabCodeEvaluator(CodeEvaluator):
# Delete the created file.
os.remove(self.submit_code_path)
- # def compile_code(self, user_answer, test_case):
- # if hasattr(self, 'compiled_output'):
- # return None
- # else:
- # ref_code_path = test_case
- # clean_ref_path, clean_test_case_path = self._set_test_code_file_path(ref_code_path)
- # user_answer, terminate_commands = self._remove_scilab_exit(user_answer.lstrip())
-
- # self.write_to_submit_code_file(self.submit_code_path, user_answer)
- # # Throw message if there are commmands that terminates scilab
- # self.add_err = ""
- # if terminate_commands:
- # self.add_err = "Please do not use exit, quit and abort commands in your\
- # code.\n Otherwise your code will not be evaluated\
- # correctly.\n"
-
- # cmd = 'printf "lines(0)\nexec(\'{0}\',2);\nquit();"'.format(clean_ref_path)
- # cmd += ' | timeout 8 scilab-cli -nb'
- # self.compiled_output = self._run_command(cmd,
- # shell=True,
- # stdout=subprocess.PIPE,
- # stderr=subprocess.PIPE)
- # return self.compiled_output
-
def check_code(self, user_answer, test_case):
ref_code_path = test_case
clean_ref_path, clean_test_case_path = self._set_test_code_file_path(ref_code_path)
@@ -89,46 +55,12 @@ class ScilabCodeEvaluator(CodeEvaluator):
if proc.returncode == 5:
success, err = True, "Correct answer"
else:
- # err = self.add_err + stdout
err = add_err + stdout
else:
- # err = self.add_err + stderr
err = add_err + stderr
return success, err
- # def check_code(self, ref_path):
- # success = False
-
- # # Throw message if there are commmands that terminates scilab
- # add_err=""
- # if self.terminate_commands:
- # add_err = "Please do not use exit, quit and abort commands in your\
- # code.\n Otherwise your code will not be evaluated\
- # correctly.\n"
-
- # cmd = 'printf "lines(0)\nexec(\'{0}\',2);\nquit();"'.format(ref_path)
- # cmd += ' | timeout 8 scilab-cli -nb'
- # ret = self._run_command(cmd,
- # shell=True,
- # stdout=subprocess.PIPE,
- # stderr=subprocess.PIPE)
- # proc, stdout, stderr = ret
-
- # # Get only the error.
- # stderr = self._get_error(stdout)
- # if stderr is None:
- # # Clean output
- # stdout = self._strip_output(stdout)
- # if proc.returncode == 5:
- # success, err = True, "Correct answer"
- # else:
- # err = add_err + stdout
- # else:
- # err = add_err + stderr
-
- # return success, err
-
def _remove_scilab_exit(self, string):
"""
Removes exit, quit and abort from the scilab code