Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

style: fix linting and formatting issues

RinCodeForge9271f1b62935b2f
diff --git a/src/agents/question/tools/exam_mimic.py b/src/agents/question/tools/exam_mimic.py
index 0eb08fa10..56dd3e604 100644
--- a/src/agents/question/tools/exam_mimic.py
+++ b/src/agents/question/tools/exam_mimic.py
@@ -134,12 +134,14 @@ async def mimic_exam_questions(
# Resolve relative names against reference_papers
# SECURITY FIX: Prevent Path Injection / Traversal
if os.path.isabs(paper_dir) or ".." in paper_dir:
- error_msg = f"Invalid paper_dir: Absolute paths and traversal are not allowed. ({paper_dir})"
+ error_msg = (
+ f"Invalid paper_dir: Absolute paths and traversal are not allowed. ({paper_dir})"
+ )
await send_progress("error", {"content": error_msg})
return {"success": False, "error": error_msg}
paper_path = Path(paper_dir)
-
+
# Candidate locations to search (including new location)
project_root = Path(__file__).parent.parent.parent.parent.parent
possible_paths = [
@@ -167,12 +169,12 @@ async def mimic_exam_questions(
continue
if not latest_dir:
- error_msg = f"Exam directory not found: {paper_dir}"
- await send_progress("error", {"content": error_msg})
- return {
- "success": False,
- "error": f"{error_msg}\nSearched paths: {[str(p) for p in possible_paths]}",
- }
+ error_msg = f"Exam directory not found: {paper_dir}"
+ await send_progress("error", {"content": error_msg})
+ return {
+ "success": False,
+ "error": f"{error_msg}\nSearched paths: {[str(p) for p in possible_paths]}",
+ }
else:
latest_dir = paper_path.resolve()
if not latest_dir.exists():
@@ -314,9 +316,11 @@ async def mimic_exam_questions(
"reference_questions": [
{
"number": q.get("question_number", str(i + 1)),
- "preview": q["question_text"][:100] + "..."
- if len(q["question_text"]) > 100
- else q["question_text"],
+ "preview": (
+ q["question_text"][:100] + "..."
+ if len(q["question_text"]) > 100
+ else q["question_text"]
+ ),
}
for i, q in enumerate(reference_questions)
],
diff --git a/src/tools/tex_downloader.py b/src/tools/tex_downloader.py
index f4098beba..c39262ef4 100644
--- a/src/tools/tex_downloader.py
+++ b/src/tools/tex_downloader.py
@@ -11,8 +11,8 @@ Version: v1.0
Based on: TODO.md specification
"""
-from pathlib import Path
import os
+from pathlib import Path
import re
import shutil
import tarfile