Submission

class judge0api.submission.Submission[source]

Stores a representation of a Submission to/from Judge0API

This class has the following properties:

### Fields that will get sent to Judge0

# The language ID language_id = None

# These 3 must always be bytestrings. source_code stdin expected_output

# Extra Send Fields cpu_time_limit = None cpu_extra_time = None wall_time_limit = None memory_limit = None stack_limit = None max_processes_and_or_threads = None enable_per_process_and_thread_time_limit = None enable_per_process_and_thread_memory_limit = None max_file_size = None number_of_runs = None

### Fields that will be retrieved from Judge0:

# These 3 should always be bytestrings compile_output = None stdout = None stderr = None

# Receive Fields message = None exit_code = None exit_signal = None status = None created_at = None finished_at = None token = None time = None wall_time = None memory = None

In addition, the “objective” of a field can be found in the following properties - the name of which should be self explanatory:

_encoded_send_fields _encoded_response_fields _encoded_fields _extra_send_fields _response_fields _extra_response_fields _send_fields _fields

keys()[source]

Returns a list of all fields used by Judge0 :return:

load(client)[source]

Populates the object if it has a token :param client: the Judge0API client

set_properties(r)[source]

Takes a dict, and sets each value of the dict into Submission, base64 encoding it if required :param r: :return:

submit(client)[source]

Submits this Submission. Requires that self.language_id, and self.source_code is not none In addition, self.stdin and self.expected output can be set, in order to validate the result on Judge0 :param client: the Judge0API Client :raises HTTPError if the post request is not able to be completed

judge0api.submission.get(client, submission_token)[source]

Retrieves a submission from its token :param client: Judge0API client :param submission_token: token, as a string :return:

judge0api.submission.submit(client, source_code, language, stdin=None, expected_output=None, **kwargs)[source]

Creates and submits :param client: the judge0 client object :param source_code: a byte-string of the source code :param language: the language ID for this program :param stdin: a byte-string of the input for this program :param expected_output: a byte-string of the expected output :param **kwargs: any other extra arguments to be sent to the judge :return: submission