-
Notifications
You must be signed in to change notification settings - Fork 3
Update question extraction #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update question extraction #32
Conversation
This reverts commit e320a00.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Rolland-He
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @wkukka1 , nice work!
…tograding-feedback into update-question-extraction
for more information, see https://pre-commit.ci
|
|
||
| if not task_found: | ||
| print(f"Task {question_num} not found in any assignment file.") | ||
| print(f"Task {question} not found in any assignment file.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is no longer a number, put quotes around {question}
| from typing import Any, Dict, List, Optional | ||
|
|
||
|
|
||
| def extract_images(input_notebook_path: os.PathLike, output_directory: os.PathLike, output_name: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a return type annotation here (just noticed it was missing, but now it's changed)
|
|
||
| qp = Path(qmd_path) | ||
| if not qp.exists(): | ||
| raise FileNotFoundError(f"QMD/RMD file not found: {qmd_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the "/RMD" part
| start_line = 0 | ||
| fence_kind = None # "```" or "~~~" | ||
|
|
||
| while i < len(lines): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a case where i should always be incremented, it's better to use for i, raw in enumerate(lines)
pyproject.toml
Outdated
| "pillow", | ||
| "PyPDF2", | ||
| "requests", | ||
| "matplotlib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the dependencies in alphabetical order
| from typing import List, Optional | ||
| from typing import Any, Dict, List, Optional, Tuple | ||
|
|
||
| import fitz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is an old name (https://pymupdf.readthedocs.io/en/latest/tutorial.html). The package should also be added to the project dependencies
…tograding-feedback into update-question-extraction
| cur = [] | ||
| start_line = i | ||
| fence_kind = "~~~" if line.strip().startswith("~~~") else "```" | ||
| i += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a result of switching to a for loop, the i += 1 statements are no longer necessary
david-yz-liu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @wkukka1!
Updates
--questionargument.fitz(PyMuPDF) to extract the table of contents and locate headings/questions.QMDfiles, currently limited to Python code blocks.question_numwithquestion