add Python3 language support

This commit is contained in:
virusdefender 2017-04-29 18:30:16 +08:00
parent 93605e3081
commit ecaf47fef4
2 changed files with 25 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import json
import requests
from languages import c_lang_config, cpp_lang_config, java_lang_config, c_lang_spj_config, \
c_lang_spj_compile, py2_lang_config
c_lang_spj_compile, py2_lang_config, py3_lang_config
class JudgeServerClientError(Exception):
@ -102,6 +102,10 @@ if __name__ == "__main__":
s1 = s.split(" ")
print int(s1[0]) + int(s1[1])"""
py3_src = """s = input()
s1 = s.split(" ")
print(int(s1[0]) + int(s1[1]))"""
client = JudgeServerClient(token=token, server_base_url="http://test.qduoj.com:12358")
print(client.ping(), "\n\n")
@ -129,3 +133,7 @@ print int(s1[0]) + int(s1[1])"""
print(client.judge(src=py2_src, language_config=py2_lang_config,
max_cpu_time=1000, max_memory=128 * 1024 * 1024,
test_case_id="normal"), "\n\n")
print(client.judge(src=py3_src, language_config=py3_lang_config,
max_cpu_time=1000, max_memory=128 * 1024 * 1024,
test_case_id="normal"), "\n\n")

View File

@ -84,3 +84,19 @@ py2_lang_config = {
"env": default_env
}
}
py3_lang_config = {
"compile": {
"src_name": "solution.py",
"exe_name": "__pycache__/solution.cpython-35.pyc",
"max_cpu_time": 3000,
"max_real_time": 5000,
"max_memory": 128 * 1024 * 1024,
"compile_command": "/usr/bin/python3 -m py_compile {src_path}",
},
"run": {
"command": "/usr/bin/python3 {exe_path}",
"seccomp_rule": None,
"env": ["PYTHONIOENCODING=UTF-8"] + default_env
}
}