1- from typing import Any
1+ from typing import TYPE_CHECKING
22
3- from dmoj .error import InternalError
3+ from dmoj .contrib .base import BaseContribModule
4+ from dmoj .executors .base_executor import BaseExecutor
45from dmoj .result import CheckerResult
56from dmoj .utils .helper_files import parse_helper_file_error
67
1112class ContribModule (BaseContribModule ):
1213 name = 'default'
1314
14- def catch_internal_error (f : Any ) -> Any :
15- def wrapper (* args , ** kwargs ) -> CheckerResult :
16- try :
17- return f (* args , ** kwargs )
18- except InternalError as e :
19- proc = args [1 ]
20- return CheckerResult (
21- False ,
22- 0 ,
23- feedback = f'Checker exitcode { proc .returncode } ' ,
24- extended_feedback = str (e ),
25- )
26-
27- return wrapper
28-
2915 @classmethod
3016 def get_checker_args_format_string (cls ) -> str :
3117 return '{input_file} {output_file} {answer_file}'
@@ -35,8 +21,23 @@ def get_interactor_args_format_string(cls) -> str:
3521 return '{input_file} {answer_file}'
3622
3723 @classmethod
24+ def get_validator_args_format_string (cls ) -> str :
25+ return '{batch_no} {case_no}'
26+
27+ @classmethod
28+ @BaseContribModule .catch_internal_error
3829 def parse_return_code (
39- cls , proc , executor , point_value , time_limit , memory_limit , feedback , extended_feedback , name , stderr , ** kwargs
30+ cls ,
31+ proc : 'TracedPopen' ,
32+ executor : BaseExecutor ,
33+ point_value : float ,
34+ time_limit : float ,
35+ memory_limit : int ,
36+ feedback : str ,
37+ extended_feedback : str ,
38+ name : str ,
39+ stderr : bytes ,
40+ ** kwargs
4041 ):
4142 if proc .returncode == cls .AC :
4243 return CheckerResult (True , point_value , feedback = feedback , extended_feedback = extended_feedback )
0 commit comments