def submit(self, contest_id, task_id, user_id, language): # Source files are stored under cmstestsuite/code/. path = os.path.join(os.path.dirname(__file__), 'code') # Choose the correct file to submit. filename = self.filename.replace("%l", language) full_path = os.path.join(path, filename) # Submit our code. self.submission_id[language] = cws_submit( contest_id, task_id, user_id, self.submission_format_element, full_path, language)
def run(self, contest_id, task_id, user_id, language): # Source files are stored under cmstestsuite/code/. path = os.path.join(os.path.dirname(__file__), 'code') # List of files to submit files = [] # For each file to be submitted # Set appropriate field name depending on format choice task_format = created_tasks[task_id]['submission_format_choice'] if task_format == "simple": # Choose the correct file to submit. There should only be one if # submission_format_choice is simple. filename = self.files[0] filename = filename.replace("%l", language) full_path = os.path.join(path, filename) # Create the correct field name field_name = '%s.%%l' % (created_tasks[task_id]['name']) # Set as file to be submitted files = [[field_name, full_path]] elif task_format == "other": # Create the list of field_name + filename pairs # First split the json-formatted list of strings in a regular # list of strings submission_format = json.loads( created_tasks[task_id]['submission_format']) filenames = map(lambda x: os.path.join(path, x), self.files) filenames = map(lambda x: x.replace("%l", language), filenames) files = zip(submission_format, filenames) files = map(list, files) # Submit our code. submission_id = cws_submit(contest_id, task_id, user_id, files, language) # Wait for evaluation to complete. result_info = get_evaluation_result(contest_id, submission_id) # Run checks. for check in self.checks: try: check.check(result_info) except TestFailure: # Our caller can deal with these. raise
def run(self, contest_id, task_id, user_id, language): # Source files are stored under cmstestsuite/code/. path = os.path.join(os.path.dirname(__file__), 'code') # List of files to submit files = [] # For each file to be submitted # Set appropriate field name depending on format choice task_format = created_tasks[task_id]['submission_format_choice'] if task_format == "simple": # Choose the correct file to submit. There should only be one if # submission_format_choice is simple. filename = self.files[0] filename = filename.replace("%l", language) full_path = os.path.join(path, filename) # Create the correct field name field_name = '%s.%%l'%(created_tasks[task_id]['name']) # Set as file to be submitted files = [[field_name, full_path]] elif task_format == "other": # Create the list of field_name + filename pairs # First split the json-formatted list of strings in a regular # list of strings submission_format = json.loads(created_tasks[task_id]['submission_format']) filenames = map(lambda x: os.path.join(path, x),self.files) filenames = map(lambda x: x.replace("%l", language), filenames) files = zip(submission_format,filenames) files = map(list,files) # Submit our code. submission_id = cws_submit(contest_id, task_id, user_id, files, language) # Wait for evaluation to complete. result_info = get_evaluation_result(contest_id, submission_id) # Run checks. for check in self.checks: try: check.check(result_info) except TestFailure: # Our caller can deal with these. raise
def run(self, contest_id, task_id, user_id, language): # Source files are stored under cmstestsuite/code/. path = os.path.join(os.path.dirname(__file__), 'code') # Choose the correct file to submit. filename = self.filename.replace("%l", language) full_path = os.path.join(path, filename) # Submit our code. submission_id = cws_submit(contest_id, task_id, user_id, full_path, language) # Wait for evaluation to complete. result_info = get_evaluation_result(contest_id, submission_id) # Run checks. for check in self.checks: try: check.check(result_info) except TestFailure: # Our caller can deal with these. raise
def submit(self, contest_id, task_id, user_id, language): filenames, full_paths = self._sources_names(language) self.submission_id[language] = cws_submit(contest_id, task_id, user_id, self.submission_format, full_paths, language)
def submit(self, contest_id, task_id, user_id, language): filenames, full_paths = self._sources_names(language) self.submission_id[language] = cws_submit( contest_id, task_id, user_id, self.submission_format, full_paths, language)