PyKubeGrader 0.2.25__py3-none-any.whl → 0.2.26__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.2.25
3
+ Version: 0.2.26
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -1,20 +1,20 @@
1
1
  pykubegrader/__init__.py,sha256=AoAkdfIjDDZGWLlsIRENNq06L9h46kDGBIE8vRmsCfg,311
2
- pykubegrader/initialize.py,sha256=lJu0h-fMUMRxZ70rFAEXix3H6j-TcRaxveC2SIKTzF4,3903
2
+ pykubegrader/initialize.py,sha256=W-O1d9hy6BIYS28x3kcLG50WnNC4196eZwqwzVZdsgU,3902
3
3
  pykubegrader/telemetry.py,sha256=h8PPrXWGFgPWCcrChJo2woqd_XIPMFfYcxgLJ0CWpH8,5360
4
4
  pykubegrader/utils.py,sha256=T3GYnLnTL9VXjTZNPr00sUgMgobQYsNTGwynMyXdvHk,696
5
5
  pykubegrader/validate.py,sha256=2KLSB3wfFZbBh1NGgmrOV073paKAgrQz4AgA6LmCIj4,11076
6
6
  pykubegrader/build/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
7
7
  pykubegrader/build/api_notebook_builder.py,sha256=IzzU_jh6SYSA2wtjtlhxa4t9WM8-JqWnWsV8e3UPwdo,20305
8
- pykubegrader/build/build_folder.py,sha256=Zd0E_R_UciK61wrUprrFSqw6Ara8EGzoa4TP2WmmOIQ,82944
8
+ pykubegrader/build/build_folder.py,sha256=D8zNP6tFDR0S9zFIqutcPHZGw6px3vpIwnoVsl2LbvE,82949
9
9
  pykubegrader/build/clean_folder.py,sha256=8N0KyL4eXRs0DCw-V_2jR9igtFs_mOFMQufdL6tD-38,1323
10
10
  pykubegrader/graders/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
11
11
  pykubegrader/graders/late_assignments.py,sha256=_2-rA5RqO0BWY9WAQA_mbCxxPKTOiJOl-byD2CYWaE0,1393
12
12
  pykubegrader/log_parser/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
13
- pykubegrader/log_parser/parse.ipynb,sha256=H1CUuqiUSE-tiZV1IS7VG6HAEvoopGd6i_5QM5CwoE0,12230
14
- pykubegrader/log_parser/parse.py,sha256=YCs_OCnoxQKsL55MjTZWXBBBsehJL8PIB9ANnC-aE44,7379
15
- pykubegrader/submit/submit_assignment.py,sha256=p-v31479342q0AO3lJrd8Fwk7iJQUz183OeGeiNcXOY,3405
16
- pykubegrader/tokens/tokens.py,sha256=DorNwdrA5N5apB3LQjVGa2ABN5C1upkgglecaLHobr0,1260
17
- pykubegrader/tokens/validate_token.py,sha256=q5aJ0hUsFTDgrSfAszPS5RpxwTKODAguFqkZkKjkN3k,4058
13
+ pykubegrader/log_parser/parse.ipynb,sha256=5e-9dzUbJk2M8kPP55lVeksm86lSY5ocKfWOP2RSWH0,11921
14
+ pykubegrader/log_parser/parse.py,sha256=dXzTEOTI6VTRNoHFDAjg6hZUhvB3kHtMb10_KW3NPrw,7641
15
+ pykubegrader/submit/submit_assignment.py,sha256=UgJXKWw5b8-bRSFnba4iHAyXnujULHcWIask7hKx9ik,3421
16
+ pykubegrader/tokens/tokens.py,sha256=qMUN4aCR9NB_KVfyA13pbqt0nkjDmd0_C04CI-RD1So,1260
17
+ pykubegrader/tokens/validate_token.py,sha256=kzXZPCVyYAedSmnzekIdwAhjBY3ZCMUrqOHOKFKAssI,4123
18
18
  pykubegrader/widgets/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
19
19
  pykubegrader/widgets/multiple_choice.py,sha256=NjD3-uXSnibpUQ0mO3hRp_O-rynFyl0Dz6IXE4tnCRI,2078
20
20
  pykubegrader/widgets/reading_question.py,sha256=y30_swHwzH8LrT8deWTnxctAAmR8BSxTlXAqMgUrAT4,3031
@@ -27,9 +27,9 @@ pykubegrader/widgets_base/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-
27
27
  pykubegrader/widgets_base/multi_select.py,sha256=Cl0IN21wXLZuFu-zC65aS9tD4jMfzCRJ2DPjHao5_Ak,4044
28
28
  pykubegrader/widgets_base/reading.py,sha256=_vjUPynqmJe_R4vf-7hVhGnQR726S9GL6qT8bflBXBM,5383
29
29
  pykubegrader/widgets_base/select.py,sha256=Fw3uFNOIWo1a3CvlzSx23bvi6bSmA3TqutuRbhD4Dp8,2525
30
- PyKubeGrader-0.2.25.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
31
- PyKubeGrader-0.2.25.dist-info/METADATA,sha256=v_-jmszT5LaejR9v3YIDeQHgGDkRO7-jMVCC3Oi9cwg,2779
32
- PyKubeGrader-0.2.25.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
33
- PyKubeGrader-0.2.25.dist-info/entry_points.txt,sha256=UPMdTT46fQwTYJWtrUwIWIbXbwyOPfNQgBFRa0frWzw,138
34
- PyKubeGrader-0.2.25.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
35
- PyKubeGrader-0.2.25.dist-info/RECORD,,
30
+ PyKubeGrader-0.2.26.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
31
+ PyKubeGrader-0.2.26.dist-info/METADATA,sha256=PHetJ4aQEkMSYy0E6kMfn48RYDy6ZXmesTwd3pHmZfg,2779
32
+ PyKubeGrader-0.2.26.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
33
+ PyKubeGrader-0.2.26.dist-info/entry_points.txt,sha256=UPMdTT46fQwTYJWtrUwIWIbXbwyOPfNQgBFRa0frWzw,138
34
+ PyKubeGrader-0.2.26.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
35
+ PyKubeGrader-0.2.26.dist-info/RECORD,,
@@ -22,13 +22,11 @@ try:
22
22
  except: # noqa: E722
23
23
  print("Passwords not found, cannot access database")
24
24
 
25
- import nbformat
26
-
27
- from .api_notebook_builder import FastAPINotebookBuilder
28
25
  from typing import Optional
29
26
 
27
+ import nbformat
30
28
 
31
- import os
29
+ from .api_notebook_builder import FastAPINotebookBuilder
32
30
 
33
31
  os.environ["JUPYTERHUB_USER"] = "jca92"
34
32
  os.environ["TOKEN"] = "token"
@@ -180,9 +178,7 @@ class NotebookProcessor:
180
178
  self.update_initialize_function()
181
179
 
182
180
  def update_initialize_function(self):
183
-
184
181
  for key, value in self.total_point_log.items():
185
-
186
182
  assignment_tag = f"week{self.week_num}-{self.assignment_type}"
187
183
 
188
184
  update_initialize_assignment(
@@ -724,6 +720,7 @@ class NotebookProcessor:
724
720
  with open(notebook_path, "w", encoding="utf-8") as f:
725
721
  nbformat.write(notebook, f)
726
722
 
723
+ @staticmethod
727
724
  def add_validate_token_cell(notebook_path: str, require_key: bool) -> None:
728
725
  """
729
726
  Adds a new code cell at the top of a Jupyter notebook if require_key is True.
@@ -2,14 +2,16 @@ import hashlib
2
2
  import os
3
3
  import shutil
4
4
  from pathlib import Path
5
+ from typing import Optional
5
6
 
6
7
  import panel as pn
7
8
  import requests
8
9
  from IPython import get_ipython
9
- from typing import Optional
10
+
10
11
  from .telemetry import ensure_responses, log_variable, telemetry, update_responses
11
12
 
12
- #TODO: could cleanup to remove redundant imports
13
+
14
+ # TODO: could cleanup to remove redundant imports
13
15
  def initialize_assignment(
14
16
  name: str,
15
17
  week: str,
@@ -33,7 +35,7 @@ def initialize_assignment(
33
35
  Raises:
34
36
  Exception: If the environment is unsupported or initialization fails.
35
37
  """
36
-
38
+
37
39
  if assignment_tag is None:
38
40
  assignment_tag = f"{week}-{assignment_type}"
39
41
 
@@ -6,17 +6,12 @@
6
6
  "metadata": {},
7
7
  "outputs": [],
8
8
  "source": [
9
+ "# ruff: noqa\n",
10
+ "\n",
9
11
  "# Get the public/private keypair for decryption\n",
10
12
  "key_box = get_keybox()"
11
13
  ]
12
14
  },
13
- {
14
- "cell_type": "code",
15
- "execution_count": null,
16
- "metadata": {},
17
- "outputs": [],
18
- "source": []
19
- },
20
15
  {
21
16
  "cell_type": "code",
22
17
  "execution_count": null,
@@ -151,7 +146,7 @@
151
146
  "parser = LogParser(log_lines=log_lines, week_tag=\"week1-readings\")\n",
152
147
  "parser.parse_logs()\n",
153
148
  "parser.calculate_total_scores()\n",
154
- "results = parser.get_results() \n",
149
+ "results = parser.get_results()\n",
155
150
  "\n",
156
151
  "results"
157
152
  ]
@@ -192,13 +187,6 @@
192
187
  "results"
193
188
  ]
194
189
  },
195
- {
196
- "cell_type": "code",
197
- "execution_count": null,
198
- "metadata": {},
199
- "outputs": [],
200
- "source": []
201
- },
202
190
  {
203
191
  "cell_type": "code",
204
192
  "execution_count": null,
@@ -218,7 +206,7 @@
218
206
  "time_stamp = results[\"student_information\"][\"timestamp\"]\n",
219
207
  "\n",
220
208
  "week_num = results[\"week_num\"]\n",
221
- "assignment_type = results['assignment_type']\n",
209
+ "assignment_type = results[\"assignment_type\"]\n",
222
210
  "\n",
223
211
  "assignments_graded = results[\"assignment_information\"].keys()\n",
224
212
  "total_score = 0\n",
@@ -253,13 +241,6 @@
253
241
  "source": [
254
242
  "student_email"
255
243
  ]
256
- },
257
- {
258
- "cell_type": "code",
259
- "execution_count": null,
260
- "metadata": {},
261
- "outputs": [],
262
- "source": []
263
244
  }
264
245
  ],
265
246
  "metadata": {
@@ -1,5 +1,14 @@
1
1
  from dataclasses import dataclass, field
2
- from typing import Optional
2
+ from typing import Any, Optional, TypedDict
3
+
4
+
5
+ class LogParserResults(TypedDict):
6
+ student_information: dict[str, str]
7
+ week: Optional[str]
8
+ week_num: Optional[int]
9
+ assignment_type: Optional[str]
10
+ assignment_information: dict[str, Any]
11
+ assignment_scores: dict[str, Any]
3
12
 
4
13
 
5
14
  @dataclass
@@ -160,7 +169,7 @@ class LogParser:
160
169
  total_score = sum(q["score_earned"] for q in data["questions"].values())
161
170
  data["total_score"] = total_score
162
171
 
163
- def get_results(self) -> dict[str, dict]:
172
+ def get_results(self) -> LogParserResults:
164
173
  """
165
174
  Returns the parsed results as a hierarchical dictionary with three sections:
166
175
  """
@@ -1,8 +1,9 @@
1
- import os
2
- import httpx
3
1
  import asyncio
4
- import nest_asyncio
5
2
  import base64
3
+ import os
4
+
5
+ import httpx
6
+ import nest_asyncio # type: ignore
6
7
 
7
8
  # Apply nest_asyncio for environments like Jupyter
8
9
  nest_asyncio.apply()
@@ -43,7 +44,7 @@ async def call_score_assignment(
43
44
  # Get credentials
44
45
  credentials = get_credentials()
45
46
  username = credentials["username"]
46
- password = credentials["password"]
47
+ password = credentials["password"]
47
48
 
48
49
  # Encode credentials for Basic Authentication
49
50
  auth_header = (
@@ -1,10 +1,10 @@
1
- import requests
2
- import os
3
1
  import json
2
+ import os
4
3
 
4
+ import requests
5
5
 
6
- def build_token_payload(token: str, duration: int) -> dict:
7
6
 
7
+ def build_token_payload(token: str, duration: int) -> dict:
8
8
  if os.getenv("JUPYTERHUB_USER", None) is None:
9
9
  raise ValueError("JupyterHub user not found")
10
10
 
@@ -1,8 +1,10 @@
1
- import os
1
+ import asyncio
2
2
  import base64
3
+ import os
4
+ from typing import Optional
5
+
3
6
  import httpx
4
- import asyncio
5
- import nest_asyncio
7
+ import nest_asyncio # type: ignore
6
8
 
7
9
  # Apply nest_asyncio for environments like Jupyter
8
10
  nest_asyncio.apply()
@@ -39,7 +41,7 @@ def get_credentials():
39
41
  return {"username": username, "password": password}
40
42
 
41
43
 
42
- async def async_validate_token(token: str = None) -> None:
44
+ async def async_validate_token(token: Optional[str] = None) -> None:
43
45
  """
44
46
  Asynchronously validate a token by making a GET request to the validation endpoint.
45
47
 
@@ -103,7 +105,7 @@ async def async_validate_token(token: str = None) -> None:
103
105
  raise TokenValidationError(f"An unexpected error occurred: {e}")
104
106
 
105
107
 
106
- def validate_token(token: str = None) -> None:
108
+ def validate_token(token: Optional[str] = None) -> None:
107
109
  """
108
110
  Synchronous wrapper for the `async_validate_token` function.
109
111