forked from lutece-awesome/osiris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjudge_result.py
66 lines (57 loc) · 1.22 KB
/
judge_result.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from enum import Enum, unique
class _meta:
__slots__ = (
'full',
'_field'
)
def __init__( self , ** kw ):
for _ in kw:
self.__setattr__( _ , kw[_] )
self._field = [x for x in kw]
def __str__(self):
return self.full
def __repr__(self):
return str( self.full )
@property
def attribute(self):
return { x : getattr( self , x ) for x in self._field }
@unique
class Judge_result( Enum ):
PD = _meta(
full = 'Pending',
)
PR = _meta(
full = 'Preparing',
)
AC = _meta(
full = 'Accepted',
)
RN = _meta(
full = 'Running',
)
CE = _meta(
full = 'Compile Error',
)
WA = _meta(
full = 'Wrong Answer',
)
RE = _meta(
full = 'Runtime Error',
)
TLE = _meta(
full = 'Time Limit Exceeded',
)
OLE = _meta(
full = 'Output Limit Exceeded',
)
MLE = _meta(
full = 'Memory Limit Exceeded',
)
JE = _meta(
full = 'Judger Error',
)
def get_judge_result( result ):
for each_result in Judge_result:
if each_result.value.full == result:
return each_result
return None