PyKubeGrader 0.1.10__tar.gz → 0.1.11__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pykubegrader-0.1.10/src/PyKubeGrader.egg-info → pykubegrader-0.1.11}/PKG-INFO +1 -1
- {pykubegrader-0.1.10 → pykubegrader-0.1.11/src/PyKubeGrader.egg-info}/PKG-INFO +1 -1
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/build/build_folder.py +23 -24
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/.coveragerc +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/.github/workflows/main.yml +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/.gitignore +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/.readthedocs.yml +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/AUTHORS.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/CHANGELOG.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/CONTRIBUTING.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/LICENSE.txt +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/README.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/Makefile +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/_static/Drexel_blue_Logo_square_Dark.png +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/_static/Drexel_blue_Logo_square_Light.png +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/_static/custom.css +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/authors.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/changelog.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/conf.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/contributing.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/index.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/license.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/readme.rst +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/docs/requirements.txt +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/examples/.responses.json +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/examples/true_false.ipynb +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/pyproject.toml +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/setup.cfg +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/setup.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/PyKubeGrader.egg-info/SOURCES.txt +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/PyKubeGrader.egg-info/dependency_links.txt +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/PyKubeGrader.egg-info/entry_points.txt +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/PyKubeGrader.egg-info/not-zip-safe +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/PyKubeGrader.egg-info/requires.txt +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/PyKubeGrader.egg-info/top_level.txt +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/__init__.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/build/api_notebook_builder.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/initialize.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/telemetry.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/utils.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/validate.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets/__init__.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets/multiple_choice.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets/reading_question.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets/select_many.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets/student_info.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets/style.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets/true_false.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets/types_question.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets_base/__init__.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets_base/multi_select.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets_base/reading.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/src/pykubegrader/widgets_base/select.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/tests/conftest.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/tests/import_test.py +0 -0
- {pykubegrader-0.1.10 → pykubegrader-0.1.11}/tox.ini +0 -0
@@ -166,7 +166,7 @@ class NotebookProcessor:
|
|
166
166
|
Returns:
|
167
167
|
None
|
168
168
|
"""
|
169
|
-
|
169
|
+
|
170
170
|
print(f"Processing notebook: {notebook_path}")
|
171
171
|
|
172
172
|
logging.info(f"Processing notebook: {notebook_path}")
|
@@ -333,7 +333,7 @@ class NotebookProcessor:
|
|
333
333
|
def add_initialization_code(notebook_path):
|
334
334
|
# finds the first code cell
|
335
335
|
index, cell = find_first_code_cell(notebook_path)
|
336
|
-
cell = cell[
|
336
|
+
cell = cell["source"]
|
337
337
|
import_text = "from pykubegrader.initialize import initialize_assignment\n"
|
338
338
|
cell = f"{import_text}\n" + cell
|
339
339
|
cell += f'\nresponses = initialize_assignment("{os.path.splitext(os.path.basename(notebook_path))[0]}")\n'
|
@@ -627,7 +627,7 @@ class NotebookProcessor:
|
|
627
627
|
"""
|
628
628
|
|
629
629
|
solutions = {}
|
630
|
-
total_points =
|
630
|
+
total_points = []
|
631
631
|
|
632
632
|
# If the output file exists, load the existing solutions and total_points
|
633
633
|
if os.path.exists(output_file):
|
@@ -641,14 +641,14 @@ class NotebookProcessor:
|
|
641
641
|
if hasattr(existing_module, "solutions"):
|
642
642
|
solutions.update(existing_module.solutions)
|
643
643
|
if hasattr(existing_module, "total_points"):
|
644
|
-
total_points
|
644
|
+
total_points.extend(existing_module.total_points)
|
645
645
|
|
646
646
|
# Process new question data and update solutions and total_points
|
647
647
|
for question_set in data_list:
|
648
648
|
for key, question_data in question_set.items():
|
649
649
|
solution_key = f"q{question_data['question number']}-{question_data['subquestion_number']}-{key}"
|
650
650
|
solutions[solution_key] = question_data["solution"]
|
651
|
-
total_points
|
651
|
+
total_points.extend([question_data["points"]])
|
652
652
|
|
653
653
|
# Write updated total_points and solutions back to the file
|
654
654
|
with open(output_file, "w", encoding="utf-8") as f:
|
@@ -1577,29 +1577,28 @@ def find_first_code_cell(notebook_path):
|
|
1577
1577
|
|
1578
1578
|
|
1579
1579
|
def replace_cell_source(notebook_path, cell_index, new_source):
|
1580
|
-
|
1581
|
-
|
1580
|
+
"""
|
1581
|
+
Replace the source code of a specific Jupyter notebook cell.
|
1582
1582
|
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1583
|
+
Args:
|
1584
|
+
cell_index (int): Index of the cell to be modified (0-based).
|
1585
|
+
new_source (str): New source code to replace the cell's content.
|
1586
|
+
"""
|
1587
|
+
# Load the notebook
|
1588
|
+
with open(notebook_path, "r", encoding="utf-8") as f:
|
1589
|
+
notebook = nbformat.read(f, as_version=4)
|
1590
1590
|
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
f"Cell index {cell_index} is out of range for this notebook."
|
1595
|
-
)
|
1591
|
+
# Check if the cell index is valid
|
1592
|
+
if cell_index >= len(notebook.cells) or cell_index < 0:
|
1593
|
+
raise IndexError(f"Cell index {cell_index} is out of range for this notebook.")
|
1596
1594
|
|
1597
|
-
|
1598
|
-
|
1595
|
+
# Replace the source code of the specified cell
|
1596
|
+
notebook.cells[cell_index]["source"] = new_source
|
1597
|
+
|
1598
|
+
# Save the notebook
|
1599
|
+
with open(notebook_path, "w", encoding="utf-8") as f:
|
1600
|
+
nbformat.write(notebook, f)
|
1599
1601
|
|
1600
|
-
# Save the notebook
|
1601
|
-
with open(notebook_path, "w", encoding="utf-8") as f:
|
1602
|
-
nbformat.write(notebook, f)
|
1603
1602
|
|
1604
1603
|
def main():
|
1605
1604
|
parser = argparse.ArgumentParser(
|
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
|