forked from DMOJ/judge-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPYPY.py
22 lines (17 loc) · 760 Bytes
/
PYPY.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from typing import List, Tuple
from dmoj.executors.python_executor import PythonExecutor
class Executor(PythonExecutor):
command = 'pypy'
test_program = "print __import__('sys').stdin.read()"
_pypy_versions: List[Tuple[int, ...]]
@classmethod
def parse_version(cls, command, output):
try:
cls._pypy_versions = [tuple(map(int, version.split('.'))) for version in cls.version_regex.findall(output)]
return cls._pypy_versions[1]
except Exception:
return None
@classmethod
def get_runtime_versions(cls):
# A little hack to report implemented Python version too
return tuple(list(super().get_runtime_versions()) + [('implementing python', cls._pypy_versions[0])])