PyKubeGrader 0.1.10__py3-none-any.whl → 0.1.11__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyKubeGrader
3
- Version: 0.1.10
3
+ Version: 0.1.11
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -4,7 +4,7 @@ pykubegrader/telemetry.py,sha256=Zkap_ml7hWz7akBVzE-zqri_K-AkBSTEhv0IE3VM9iY,394
4
4
  pykubegrader/utils.py,sha256=dKw6SyRYU3DWRgD3xER7wq-C9e1daWPkqr901LpcwiQ,642
5
5
  pykubegrader/validate.py,sha256=PeT6Gx4ZOQYyogG4nb3TD9YfEkAmf__fR1aOOB3ZBWo,10705
6
6
  pykubegrader/build/api_notebook_builder.py,sha256=vtRA9lDCc-PXN-y56wEXS-h_aKXDU_ChS-1_ooiKCOk,18975
7
- pykubegrader/build/build_folder.py,sha256=HkyzQAPUJBB4VkRLllllyy1eqbe2EMa-NREVy8qbSeg,63417
7
+ pykubegrader/build/build_folder.py,sha256=m7PkiAvpC5kIcm9A2BLtTncWJo4S1fuup5ZCo35VZys,63323
8
8
  pykubegrader/widgets/__init__.py,sha256=s3ky3eJDa1RedFVdpKxmqv6mHBYpOSL9Z6qThSH9cbs,303
9
9
  pykubegrader/widgets/multiple_choice.py,sha256=NjD3-uXSnibpUQ0mO3hRp_O-rynFyl0Dz6IXE4tnCRI,2078
10
10
  pykubegrader/widgets/reading_question.py,sha256=y30_swHwzH8LrT8deWTnxctAAmR8BSxTlXAqMgUrAT4,3031
@@ -17,9 +17,9 @@ pykubegrader/widgets_base/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-
17
17
  pykubegrader/widgets_base/multi_select.py,sha256=u50IOhYxC_S_gq31VnFPLdbNajk_SUWhaqlMSJxhqVQ,3439
18
18
  pykubegrader/widgets_base/reading.py,sha256=4uTLmlPzCwxVzufFhPjM7W19uMGguRb6y4eAV3x-zAc,5314
19
19
  pykubegrader/widgets_base/select.py,sha256=h1S5StcbX8S-Wiyga4fVDhPbVvRxffwaqyVbiiuInRs,2743
20
- PyKubeGrader-0.1.10.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
21
- PyKubeGrader-0.1.10.dist-info/METADATA,sha256=3lNx_8olR4Gf2iX_Sy8jzbx-xZzrgv_YmhB-eqo9CXU,2665
22
- PyKubeGrader-0.1.10.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
23
- PyKubeGrader-0.1.10.dist-info/entry_points.txt,sha256=Kd4Bh-i3hc4qlnLU1p0nc8yPw9cC5AQGOtkk2eLGnQw,78
24
- PyKubeGrader-0.1.10.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
25
- PyKubeGrader-0.1.10.dist-info/RECORD,,
20
+ PyKubeGrader-0.1.11.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
21
+ PyKubeGrader-0.1.11.dist-info/METADATA,sha256=as-usJZup_AKIA1HVysnVKuWs9XlZfAtWNUhFriar0s,2665
22
+ PyKubeGrader-0.1.11.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
23
+ PyKubeGrader-0.1.11.dist-info/entry_points.txt,sha256=Kd4Bh-i3hc4qlnLU1p0nc8yPw9cC5AQGOtkk2eLGnQw,78
24
+ PyKubeGrader-0.1.11.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
25
+ PyKubeGrader-0.1.11.dist-info/RECORD,,
@@ -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['source']
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 = 0.0
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 += existing_module.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 += question_data["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
- Replace the source code of a specific Jupyter notebook cell.
1580
+ """
1581
+ Replace the source code of a specific Jupyter notebook cell.
1582
1582
 
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)
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
- # Check if the cell index is valid
1592
- if cell_index >= len(notebook.cells) or cell_index < 0:
1593
- raise IndexError(
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
- # Replace the source code of the specified cell
1598
- notebook.cells[cell_index]["source"] = new_source
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(