@@ -42,7 +42,7 @@ def N_(message: str):
4242 return message
4343
4444
45- COMPILATION_MESSAGES = MessageCollection ([
45+ COMPILATION_MESSAGES = MessageCollection ("compilation" , [
4646 HumanMessage ("success" ,
4747 N_ ("Compilation succeeded" ),
4848 N_ ("Your submission successfully compiled to an "
@@ -54,17 +54,20 @@ def N_(message: str):
5454 N_ ("Compilation timed out" ),
5555 N_ ("Your submission exceeded the time limit while compiling. "
5656 "This might be caused by an excessive use of C++ "
57- "templates, for example." )),
57+ "templates, for example." ),
58+ inline_help = True ),
5859 HumanMessage ("memorylimit" ,
5960 N_ ("Compilation memory limit exceeded" ),
6061 N_ ("Your submission exceeded the memory limit while compiling. "
6162 "This might be caused by an excessive use of C++ "
62- "templates, or too large global variables, for example." )),
63+ "templates, or too large global variables, for example." ),
64+ inline_help = True ),
6365 HumanMessage ("signal" ,
6466 N_ ("Compilation killed with signal %s" ),
6567 N_ ("Your submission was killed with the specified signal. "
6668 "This might be caused by a bug in the compiler, "
67- "for example." )),
69+ "for example." ),
70+ inline_help = True ),
6871])
6972
7073
@@ -89,8 +92,9 @@ def compilation_step(
8992 executable, False if not, None if success is False;
9093 * text: a human readable, localized message to inform contestants
9194 of the status; it is either an empty list (for no message) or a
92- list of strings were the second to the last are formatting
93- arguments for the first, or None if success is False;
95+ list of strings were the first is a message ID and the rest are
96+ format arguments for that message, if the message takes any; or
97+ None if success is False;
9498 * stats: a dictionary with statistics about the compilation, or None
9599 if success is False.
96100
@@ -121,37 +125,37 @@ def compilation_step(
121125 if exit_status == Sandbox .EXIT_OK :
122126 # Execution finished successfully and the executable was generated.
123127 logger .debug ("Compilation successfully finished." )
124- text = [COMPILATION_MESSAGES . get ( " success"). message ]
128+ text = ["compilation: success" ]
125129 return True , True , text , stats
126130
127131 elif exit_status == Sandbox .EXIT_NONZERO_RETURN :
128132 # Error in compilation: no executable was generated, and we return
129133 # an error to the user.
130134 logger .debug ("Compilation failed." )
131- text = [COMPILATION_MESSAGES . get ( " fail"). message ]
135+ text = ["compilation: fail" ]
132136 return True , False , text , stats
133137
134138 elif exit_status == Sandbox .EXIT_TIMEOUT or \
135139 exit_status == Sandbox .EXIT_TIMEOUT_WALL :
136140 # Timeout: we assume it is the user's fault, and we return the error
137141 # to them.
138142 logger .debug ("Compilation timed out." )
139- text = [COMPILATION_MESSAGES . get ( " timeout"). message ]
143+ text = ["compilation: timeout" ]
140144 return True , False , text , stats
141145
142146 elif exit_status == Sandbox .EXIT_MEM_LIMIT :
143147 # Memory limit: we assume it is the user's fault, and we return the
144148 # error to them.
145149 logger .debug ("Compilation memory limit exceeded." )
146- text = [COMPILATION_MESSAGES . get ( " memorylimit"). message ]
150+ text = ["compilation: memorylimit" ]
147151 return True , False , text , stats
148152
149153 elif exit_status == Sandbox .EXIT_SIGNAL :
150154 # Terminated by signal: we assume again it is the user's fault, and
151155 # we return the error to them.
152156 signal = stats ["signal" ]
153157 logger .debug ("Compilation killed with signal %s." , signal )
154- text = [COMPILATION_MESSAGES . get ( " signal"). message , str (signal )]
158+ text = ["compilation: signal" , str (signal )]
155159 return True , False , text , stats
156160
157161 elif exit_status == Sandbox .EXIT_SANDBOX_ERROR :
0 commit comments