@@ -142,7 +142,11 @@ def get_initial_instruction(questions:List[str],language:str) -> str:
142142 [get_initial_instruction (pytest_longrepr_list , explanation_in ), get_report_header (explanation_in )]
143143 + pytest_longrepr_list
144144 # Add the code and instructions
145- + [get_report_footer (explanation_in ), get_code_instruction (student_files , readme_file , explanation_in )]
145+ + [
146+ get_report_footer (explanation_in ),
147+ get_student_code_block (student_files , explanation_in ,),
148+ get_instruction_block (readme_file , explanation_in ,)
149+ ]
146150 )
147151
148152 # Join all questions into a single string
@@ -245,42 +249,7 @@ def get_report_footer(explanation_in:str) -> str:
245249 )
246250
247251
248- @functools .lru_cache
249- def get_code_instruction (
250- student_files :Tuple [pathlib .Path ],
251- readme_file :pathlib .Path ,
252- explanation_in :str ,
253- ) -> str :
254-
255- d_homework_start = {
256- 'Korean' : "숙제 제출 코드 시작" ,
257- 'English' : "Homework Submission Code Start" ,
258- 'Bahasa Indonesia' : "Kode Pengumpulan Tugas Dimulai" ,
259- 'Chinese' : "作业提交代码开始" ,
260- 'French' : '''Début du code de soumission des devoirs''' ,
261- 'German' : "Code für die Einreichung von Hausaufgaben von hier aus" ,
262- 'Italian' : "Inizio del codice di invio dei compiti" ,
263- 'Japanese' : "宿題提出コード開始" ,
264- 'Nederlands' : "Huiswerk inzendcode begint" ,
265- 'Spanish' : "Inicio del código de envío de tareas" ,
266- 'Thai' : "การส่งงานเริ่มต้น" ,
267- 'Vietnamese' : "Bắt đầu mã nộp bài tập" ,
268- }
269-
270- d_homework_end = {
271- 'Korean' : "숙제 제출 코드 끝" ,
272- 'English' : "Homework Submission Code End" ,
273- 'Bahasa Indonesia' : "Kode Pengumpulan Tugas Berakhir" ,
274- 'Chinese' : "作业提交代码结束" ,
275- 'French' : '''Fin du code de soumission des devoirs''' ,
276- 'German' : "Ende der Hausaufgaben-Einreichungscodes" ,
277- 'Italian' : "Fine del codice di invio dei compiti" ,
278- 'Japanese' : "宿題提出コード終わり" ,
279- 'Nederlands' : "Huiswerk inzendcode eindigt" ,
280- 'Spanish' : "Fin del código de envío de tareas" ,
281- 'Thai' : "การส่งงานสิ้นสุด" ,
282- 'Vietnamese' : "Mã nộp bài tập kết thúc" ,
283- }
252+ def get_instruction_block (readme_file :pathlib .Path , explanation_in :str = 'Korean' ,) -> str :
284253
285254 d_instruction_start = {
286255 'Korean' : "과제 지침 시작" ,
@@ -313,15 +282,51 @@ def get_code_instruction(
313282 }
314283
315284 return (
316- f"\n \n ## { d_homework_start [explanation_in ]} \n "
317- f"{ assignment_code (student_files )} \n "
318- f"## { d_homework_end [explanation_in ]} \n "
319285 f"## { d_instruction_start [explanation_in ]} \n "
320286 f"{ assignment_instruction (readme_file )} \n "
321287 f"## { d_instruction_end [explanation_in ]} \n "
322288 )
323289
324290
291+ def get_student_code_block (student_files :Tuple [pathlib .Path ], explanation_in :str ) -> str :
292+
293+ d_homework_start = {
294+ 'Korean' : "숙제 제출 코드 시작" ,
295+ 'English' : "Homework Submission Code Start" ,
296+ 'Bahasa Indonesia' : "Kode Pengumpulan Tugas Dimulai" ,
297+ 'Chinese' : "作业提交代码开始" ,
298+ 'French' : '''Début du code de soumission des devoirs''' ,
299+ 'German' : "Code für die Einreichung von Hausaufgaben von hier aus" ,
300+ 'Italian' : "Inizio del codice di invio dei compiti" ,
301+ 'Japanese' : "宿題提出コード開始" ,
302+ 'Nederlands' : "Huiswerk inzendcode begint" ,
303+ 'Spanish' : "Inicio del código de envío de tareas" ,
304+ 'Thai' : "เริ่มส่งรหัสการบ้าน" ,
305+ 'Vietnamese' : "Bắt đầu mã nộp bài tập" ,
306+ }
307+
308+ d_homework_end = {
309+ 'Korean' : "숙제 제출 코드 끝" ,
310+ 'English' : "Homework Submission Code End" ,
311+ 'Bahasa Indonesia' : "Kode Pengumpulan Tugas Berakhir" ,
312+ 'Chinese' : "作业提交代码结束" ,
313+ 'French' : '''Fin du code de soumission des devoirs''' ,
314+ 'German' : "Ende der Hausaufgaben-Einreichungscodes" ,
315+ 'Italian' : "Fine del codice di invio dei compiti" ,
316+ 'Japanese' : "宿題提出コード終わり" ,
317+ 'Nederlands' : "Huiswerk inzendcode eindigt" ,
318+ 'Spanish' : "Fin del código de envío de tareas" ,
319+ 'Thai' : "จบรหัสส่งการบ้าน" ,
320+ 'Vietnamese' : "Mã nộp bài tập kết thúc" ,
321+ }
322+
323+ return (
324+ f"\n \n ## { d_homework_start [explanation_in ]} \n "
325+ f"{ assignment_code (student_files )} \n "
326+ f"## { d_homework_end [explanation_in ]} \n "
327+ )
328+
329+
325330@functools .lru_cache
326331def assignment_code (student_files :Tuple [pathlib .Path ]) -> str :
327332 return '\n \n ' .join ([f"# begin : { str (f .name )} ======\n { f .read_text ()} \n # end : { str (f .name )} ======\n " for f in student_files ])
0 commit comments