PyKubeGrader 0.2.23__tar.gz → 0.2.24__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pykubegrader-0.2.23/src/PyKubeGrader.egg-info → pykubegrader-0.2.24}/PKG-INFO +1 -1
- {pykubegrader-0.2.23 → pykubegrader-0.2.24/src/PyKubeGrader.egg-info}/PKG-INFO +1 -1
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/build/build_folder.py +39 -8
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/.coveragerc +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/.github/workflows/main.yml +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/.gitignore +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/.readthedocs.yml +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/AUTHORS.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/CHANGELOG.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/CONTRIBUTING.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/LICENSE.txt +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/README.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/Makefile +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/_static/Drexel_blue_Logo_square_Dark.png +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/_static/Drexel_blue_Logo_square_Light.png +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/_static/custom.css +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/authors.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/changelog.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/conf.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/contributing.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/index.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/license.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/readme.rst +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/docs/requirements.txt +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/examples/.responses.json +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/examples/true_false.ipynb +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/pyproject.toml +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/setup.cfg +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/setup.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/PyKubeGrader.egg-info/SOURCES.txt +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/PyKubeGrader.egg-info/dependency_links.txt +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/PyKubeGrader.egg-info/entry_points.txt +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/PyKubeGrader.egg-info/not-zip-safe +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/PyKubeGrader.egg-info/requires.txt +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/PyKubeGrader.egg-info/top_level.txt +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/__init__.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/build/__init__.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/build/api_notebook_builder.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/build/clean_folder.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/graders/__init__.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/graders/late_assignments.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/initialize.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/log_parser/__init__.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/log_parser/parse.ipynb +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/log_parser/parse.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/submit/submit_assignment.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/telemetry.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/tokens/tokens.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/tokens/validate_token.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/utils.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/validate.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets/__init__.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets/multiple_choice.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets/reading_question.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets/select_many.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets/student_info.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets/style.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets/true_false.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets/types_question.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets_base/__init__.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets_base/multi_select.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets_base/reading.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/src/pykubegrader/widgets_base/select.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/tests/conftest.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/tests/import_test.py +0 -0
- {pykubegrader-0.2.23 → pykubegrader-0.2.24}/tox.ini +0 -0
@@ -60,6 +60,7 @@ class NotebookProcessor:
|
|
60
60
|
verbose: bool = False
|
61
61
|
log: bool = True
|
62
62
|
require_key: bool = False
|
63
|
+
bonus_points: float = 0
|
63
64
|
|
64
65
|
def __post_init__(self):
|
65
66
|
"""
|
@@ -80,6 +81,7 @@ class NotebookProcessor:
|
|
80
81
|
assignment = data.get("assignment", {})
|
81
82
|
week_num = assignment.get("week")
|
82
83
|
self.assignment_type = assignment.get("assignment_type")
|
84
|
+
self.bonus_points = assignment.get("bonus_points", 0)
|
83
85
|
else:
|
84
86
|
self.assignment_type = self.assignment_tag.split("-")[0].lower()
|
85
87
|
week_num = self.assignment_tag.split("-")[-1]
|
@@ -218,7 +220,6 @@ class NotebookProcessor:
|
|
218
220
|
print(f"Error parsing due_date: {e}")
|
219
221
|
|
220
222
|
title = f"Week {week} - {assignment_type}"
|
221
|
-
|
222
223
|
# Return the extracted details as a dictionary
|
223
224
|
return {
|
224
225
|
"title": title,
|
@@ -226,7 +227,7 @@ class NotebookProcessor:
|
|
226
227
|
"week_number": week,
|
227
228
|
"assignment_type": assignment_type,
|
228
229
|
"due_date": due_date,
|
229
|
-
"max_score":
|
230
|
+
"max_score": self.assignment_total_points - self.bonus_points,
|
230
231
|
}
|
231
232
|
|
232
233
|
def build_payload_notebook(self, yaml_content, notebook_title, total_points):
|
@@ -575,7 +576,7 @@ class NotebookProcessor:
|
|
575
576
|
|
576
577
|
if self.require_key:
|
577
578
|
# Add an additional line for validate_token()
|
578
|
-
validate_token_line = "from pykubegrader.
|
579
|
+
validate_token_line = "from pykubegrader.tokens.validate_token import validate_token\nvalidate_token()\n"
|
579
580
|
|
580
581
|
# Define the Code cell
|
581
582
|
code_cell = nbformat.v4.new_code_cell(
|
@@ -723,6 +724,38 @@ class NotebookProcessor:
|
|
723
724
|
with open(notebook_path, "w", encoding="utf-8") as f:
|
724
725
|
nbformat.write(notebook, f)
|
725
726
|
|
727
|
+
def add_validate_token_cell(notebook_path: str, require_key: bool) -> None:
|
728
|
+
"""
|
729
|
+
Adds a new code cell at the top of a Jupyter notebook if require_key is True.
|
730
|
+
|
731
|
+
Args:
|
732
|
+
notebook_path (str): The path to the notebook file to modify.
|
733
|
+
require_key (bool): Whether to add the validate_token cell.
|
734
|
+
|
735
|
+
Returns:
|
736
|
+
None
|
737
|
+
"""
|
738
|
+
if not require_key:
|
739
|
+
print("require_key is False. No changes made to the notebook.")
|
740
|
+
return
|
741
|
+
|
742
|
+
# Load the notebook
|
743
|
+
with open(notebook_path, "r", encoding="utf-8") as f:
|
744
|
+
notebook = nbformat.read(f, as_version=4)
|
745
|
+
|
746
|
+
# Create the new code cell
|
747
|
+
new_cell = nbformat.v4.new_code_cell(
|
748
|
+
"from pykubegrader.tokens.validate_token import validate_token\n"
|
749
|
+
"validate_token('type the key provided by your instructor here')\n"
|
750
|
+
)
|
751
|
+
|
752
|
+
# Add the new cell to the top of the notebook
|
753
|
+
notebook.cells.insert(0, new_cell)
|
754
|
+
|
755
|
+
# Save the modified notebook
|
756
|
+
with open(notebook_path, "w", encoding="utf-8") as f:
|
757
|
+
nbformat.write(notebook, f)
|
758
|
+
|
726
759
|
@staticmethod
|
727
760
|
def add_initialization_code(
|
728
761
|
notebook_path, week, assignment_type, require_key=False
|
@@ -732,15 +765,13 @@ class NotebookProcessor:
|
|
732
765
|
cell = cell["source"]
|
733
766
|
import_text = "# You must make sure to run all cells in sequence using shift + enter or you might encounter errors\n"
|
734
767
|
import_text += "from pykubegrader.initialize import initialize_assignment\n"
|
735
|
-
if require_key:
|
736
|
-
import_text += (
|
737
|
-
"from pykubegrader.tokens.validate_token import validate_token\n"
|
738
|
-
)
|
739
|
-
import_text += "validate_token('type the key provided by your TA here')\n"
|
740
768
|
import_text += f'\nresponses = initialize_assignment("{os.path.splitext(os.path.basename(notebook_path))[0]}", "{week}", "{assignment_type}" )\n'
|
741
769
|
cell = f"{import_text}\n" + cell
|
742
770
|
replace_cell_source(notebook_path, index, cell)
|
743
771
|
|
772
|
+
if require_key:
|
773
|
+
NotebookProcessor.add_validate_token_cell(notebook_path, require_key)
|
774
|
+
|
744
775
|
def multiple_choice_parser(self, temp_notebook_path, new_notebook_path):
|
745
776
|
### Parse the notebook for multiple choice questions
|
746
777
|
if self.has_assignment(temp_notebook_path, "# BEGIN MULTIPLE CHOICE"):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|