From 3f344f81e8f25c298c7cfdb8d01344fb349aaa5b Mon Sep 17 00:00:00 2001 From: Yimin Zhong Date: Sat, 31 Aug 2024 23:52:43 -0500 Subject: [PATCH] update --- grader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grader.py b/grader.py index 396d962..7f9100f 100644 --- a/grader.py +++ b/grader.py @@ -92,9 +92,9 @@ def get_dirs(self): if student_dir.endswith('.html'): zip_link = extract_link(student_dir) + '/archive/refs/heads/main.zip' r = requests.get(zip_link, allow_redirects=True, timeout=10) - open( - f'{os.path.join(self.submission_dir, Path(student_dir).stem)}.zip', 'wb')\ - .write(r.content) + with open( + f'{os.path.join(self.submission_dir, Path(student_dir).stem)}.zip', 'wb') as f: + f.write(r.content) student_dirs.add(f'{os.path.join(self.submission_dir, Path(student_dir).stem)}.zip') return student_dirs