PyKubeGrader 0.2.2__tar.gz → 0.2.4__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. {pykubegrader-0.2.2/src/PyKubeGrader.egg-info → pykubegrader-0.2.4}/PKG-INFO +1 -1
  2. {pykubegrader-0.2.2 → pykubegrader-0.2.4/src/PyKubeGrader.egg-info}/PKG-INFO +1 -1
  3. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/build/build_folder.py +20 -1
  4. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/initialize.py +9 -1
  5. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/log_parser/parse.ipynb +37 -0
  6. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/log_parser/parse.py +9 -0
  7. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/telemetry.py +1 -1
  8. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/.coveragerc +0 -0
  9. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/.github/workflows/main.yml +0 -0
  10. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/.gitignore +0 -0
  11. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/.readthedocs.yml +0 -0
  12. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/AUTHORS.rst +0 -0
  13. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/CHANGELOG.rst +0 -0
  14. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/CONTRIBUTING.rst +0 -0
  15. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/LICENSE.txt +0 -0
  16. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/README.rst +0 -0
  17. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/Makefile +0 -0
  18. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/_static/Drexel_blue_Logo_square_Dark.png +0 -0
  19. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/_static/Drexel_blue_Logo_square_Light.png +0 -0
  20. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/_static/custom.css +0 -0
  21. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/authors.rst +0 -0
  22. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/changelog.rst +0 -0
  23. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/conf.py +0 -0
  24. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/contributing.rst +0 -0
  25. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/index.rst +0 -0
  26. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/license.rst +0 -0
  27. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/readme.rst +0 -0
  28. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/docs/requirements.txt +0 -0
  29. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/examples/.responses.json +0 -0
  30. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/examples/true_false.ipynb +0 -0
  31. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/pyproject.toml +0 -0
  32. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/setup.cfg +0 -0
  33. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/setup.py +0 -0
  34. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/PyKubeGrader.egg-info/SOURCES.txt +0 -0
  35. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/PyKubeGrader.egg-info/dependency_links.txt +0 -0
  36. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/PyKubeGrader.egg-info/entry_points.txt +0 -0
  37. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/PyKubeGrader.egg-info/not-zip-safe +0 -0
  38. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/PyKubeGrader.egg-info/requires.txt +0 -0
  39. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/PyKubeGrader.egg-info/top_level.txt +0 -0
  40. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/__init__.py +0 -0
  41. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/build/__init__.py +0 -0
  42. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/build/api_notebook_builder.py +0 -0
  43. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/build/clean_folder.py +0 -0
  44. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/graders/__init__.py +0 -0
  45. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/graders/late_assignments.py +0 -0
  46. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/log_parser/__init__.py +0 -0
  47. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/utils.py +0 -0
  48. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/validate.py +0 -0
  49. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets/__init__.py +0 -0
  50. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets/multiple_choice.py +0 -0
  51. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets/reading_question.py +0 -0
  52. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets/select_many.py +0 -0
  53. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets/student_info.py +0 -0
  54. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets/style.py +0 -0
  55. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets/true_false.py +0 -0
  56. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets/types_question.py +0 -0
  57. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets_base/__init__.py +0 -0
  58. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets_base/multi_select.py +0 -0
  59. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets_base/reading.py +0 -0
  60. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/src/pykubegrader/widgets_base/select.py +0 -0
  61. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/tests/conftest.py +0 -0
  62. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/tests/import_test.py +0 -0
  63. {pykubegrader-0.2.2 → pykubegrader-0.2.4}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyKubeGrader
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyKubeGrader
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -190,6 +190,8 @@ class NotebookProcessor:
190
190
  return {
191
191
  "title": title,
192
192
  "description": str(week),
193
+ "week_number": week,
194
+ "assignment_type": assignment_type,
193
195
  "due_date": due_date,
194
196
  "max_score": int(self.assignment_total_points),
195
197
  }
@@ -503,7 +505,7 @@ class NotebookProcessor:
503
505
  NotebookProcessor.add_initialization_code(
504
506
  temp_notebook_path, self.week, self.assignment_type
505
507
  )
506
- NotebookProcessor.replace_temp_in_notebook(
508
+ NotebookProcessor.replace_temp_no_otter(
507
509
  temp_notebook_path, temp_notebook_path
508
510
  )
509
511
  return None, 0
@@ -653,6 +655,22 @@ class NotebookProcessor:
653
655
  return solution_path, question_path
654
656
  else:
655
657
  return None, None
658
+
659
+ @staticmethod
660
+ def replace_temp_no_otter(input_file, output_file):
661
+ # Load the notebook
662
+ with open(input_file, "r", encoding="utf-8") as f:
663
+ notebook = nbformat.read(f, as_version=4)
664
+
665
+ # Iterate through the cells and modify `cell.source`
666
+ for cell in notebook.cells:
667
+ if cell.cell_type == "code": # Only process code cells
668
+ if 'responses = initialize_assignment(' in cell.source:
669
+ cell.source = cell.source.replace('_temp', '')
670
+
671
+ # Save the modified notebook
672
+ with open(output_file, "w", encoding="utf-8") as f:
673
+ nbformat.write(notebook, f)
656
674
 
657
675
  @staticmethod
658
676
  def replace_temp_in_notebook(input_file, output_file):
@@ -677,6 +695,7 @@ class NotebookProcessor:
677
695
  cell["source"] = [
678
696
  line.replace("_temp.ipynb", ".ipynb") for line in cell["source"]
679
697
  ]
698
+
680
699
 
681
700
  # Write the updated notebook to the output file
682
701
  with open(output_file, "w", encoding="utf-8") as f:
@@ -1,3 +1,4 @@
1
+ import hashlib
1
2
  import os
2
3
  import shutil
3
4
  from pathlib import Path
@@ -46,7 +47,7 @@ def initialize_assignment(
46
47
  raise Exception("Setup unsuccessful. Are you on JupyterHub?")
47
48
 
48
49
  try:
49
- seed = hash(jhub_user) % 1000
50
+ seed = username_to_seed(jhub_user) % 1000
50
51
  update_responses(key="seed", value=seed)
51
52
  update_responses(key="week", value=week)
52
53
  update_responses(key="assignment_type", value=assignment_type)
@@ -111,3 +112,10 @@ def move_dotfiles():
111
112
  shutil.copy2(source_file, target_file)
112
113
  except Exception as e:
113
114
  raise Exception(f"Failed to copy {source_file} to {target_file}: {e}")
115
+
116
+
117
+ def username_to_seed(username: str, mod: int = 1000) -> int:
118
+ hash_object = hashlib.sha256(username.encode())
119
+ hash_hex = hash_object.hexdigest()
120
+ hash_int = int(hash_hex, 16)
121
+ return hash_int % mod
@@ -182,6 +182,43 @@
182
182
  "outputs": [],
183
183
  "source": []
184
184
  },
185
+ {
186
+ "cell_type": "code",
187
+ "execution_count": null,
188
+ "metadata": {},
189
+ "outputs": [],
190
+ "source": [
191
+ "student_email = results[\"student_information\"][\"username\"]\n",
192
+ "time_stamp = results[\"student_information\"][\"timestamp\"]\n",
193
+ "assignments_graded = results[\"assignment_information\"].keys()\n",
194
+ "week_num = results[\"week_num\"]\n",
195
+ "assignment_type = results['assignment_type']\n",
196
+ "\n",
197
+ "\n",
198
+ "total_score = 0\n",
199
+ "for assignment in assignments_graded:\n",
200
+ " max_points = results[\"assignment_information\"][assignment][\"max_points\"]\n",
201
+ " total_score = results[\"assignment_information\"][assignment][\"total_score\"]\n",
202
+ "\n"
203
+ ]
204
+ },
205
+ {
206
+ "cell_type": "code",
207
+ "execution_count": null,
208
+ "metadata": {},
209
+ "outputs": [],
210
+ "source": [
211
+ "def extract_score_from_dict(results):\n",
212
+ " student_email = results[\"student_information\"][\"username\"]"
213
+ ]
214
+ },
215
+ {
216
+ "cell_type": "code",
217
+ "execution_count": null,
218
+ "metadata": {},
219
+ "outputs": [],
220
+ "source": []
221
+ },
185
222
  {
186
223
  "cell_type": "code",
187
224
  "execution_count": null,
@@ -166,6 +166,15 @@ class LogParser:
166
166
  """
167
167
  return {
168
168
  "student_information": self.student_info,
169
+ "week": self.week_tag,
170
+ "week_num": (
171
+ int(self.week_tag.split("-")[0].strip().replace("week", ""))
172
+ if self.week_tag
173
+ else None
174
+ ),
175
+ "assignment_type": (
176
+ self.week_tag.split("-")[1].strip() if self.week_tag else None
177
+ ),
169
178
  "assignment_information": {
170
179
  assignment: {
171
180
  "latest_timestamp": data["latest_timestamp"],
@@ -85,7 +85,7 @@ def log_encrypted(logger: logging.Logger, message: str) -> None:
85
85
 
86
86
 
87
87
  def log_variable(assignment_name, value, info_type) -> None:
88
- timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
88
+ timestamp = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%d %H:%M:%S")
89
89
  message = f"{assignment_name}, {info_type}, {value}, {timestamp}"
90
90
  log_encrypted(logger_reduced, message)
91
91
 
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