fix many feather

This commit is contained in:
Cai
2025-09-21 05:50:19 +00:00
parent b1f832a2fb
commit 25223ac6fe
89 changed files with 1746 additions and 454 deletions

View File

@@ -1,14 +1,17 @@
import os
from ..models.function import FunctionResponse
def judge(filepath:str, name: str, course_id: str, lesson_name: str, root_path:str):
def judge(filepath:str, name: str, course_id: str, root_path:str):
"""Call this method to judge the student's solution after they have completed the problem.
Args:
filepath (`str`): The path to the file containing the student's solution.
filepath (`str`): The path from root_path to the file containing the student's solution.
name (`str`): The name of the problem.
course_id (`str`): The id of the course.
lesson_name (`str`): The name of the lesson.
root_path (`str`): The root path of the user's workspace project.
Returns:
@@ -17,6 +20,7 @@ def judge(filepath:str, name: str, course_id: str, lesson_name: str, root_path:s
# 从books/code_tests/name/中获取所有.in文件
directory = 'books/code_tests/'+course_id+'/'+name
print(f"Directory: {directory}")
# 如果目录不存在,报错
if not os.path.exists(directory):
return FunctionResponse("judge", False, f"The name {name} is not found.")
@@ -30,6 +34,7 @@ def judge(filepath:str, name: str, course_id: str, lesson_name: str, root_path:s
erroroutput = ""
exceptoutput=""
for file in in_files:
print(f"Testing {file}")
file_path = os.path.join(save_dir, f"_{name}.out")
if os.path.exists(file_path):
os.remove(file_path)