PyKubeGrader 0.2.13__py3-none-any.whl → 0.2.14__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.13
3
+ Version: 0.2.14
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -5,7 +5,7 @@ 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=FEaTj1fEsPAes7KNrPuhClEvKzLuOL3wG7Hgr7FQc-o,20083
8
- pykubegrader/build/build_folder.py,sha256=LfghCO0-CMFMua_OYwIK0-c7AlCXgGSTIQ8X45zNw-g,79679
8
+ pykubegrader/build/build_folder.py,sha256=8RTyr6nTHAzbHGPqb9zcQmenOgPdF78ylPG6IRAfl3c,79735
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
@@ -13,7 +13,7 @@ pykubegrader/log_parser/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YB
13
13
  pykubegrader/log_parser/parse.ipynb,sha256=H1CUuqiUSE-tiZV1IS7VG6HAEvoopGd6i_5QM5CwoE0,12230
14
14
  pykubegrader/log_parser/parse.py,sha256=YCs_OCnoxQKsL55MjTZWXBBBsehJL8PIB9ANnC-aE44,7379
15
15
  pykubegrader/submit/submit_assignment.py,sha256=p-v31479342q0AO3lJrd8Fwk7iJQUz183OeGeiNcXOY,3405
16
- pykubegrader/tokens/tokens.py,sha256=cM8CKUrwHkIUXE3ucSCsY9JDT-A8K-opmTpliJtGEWs,1404
16
+ pykubegrader/tokens/tokens.py,sha256=cKPs63aYwzvl-uRtogOL3kvy2W_GREOV_PTR5di9U6g,1406
17
17
  pykubegrader/widgets/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
18
18
  pykubegrader/widgets/multiple_choice.py,sha256=NjD3-uXSnibpUQ0mO3hRp_O-rynFyl0Dz6IXE4tnCRI,2078
19
19
  pykubegrader/widgets/reading_question.py,sha256=y30_swHwzH8LrT8deWTnxctAAmR8BSxTlXAqMgUrAT4,3031
@@ -26,9 +26,9 @@ pykubegrader/widgets_base/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-
26
26
  pykubegrader/widgets_base/multi_select.py,sha256=Cl0IN21wXLZuFu-zC65aS9tD4jMfzCRJ2DPjHao5_Ak,4044
27
27
  pykubegrader/widgets_base/reading.py,sha256=_vjUPynqmJe_R4vf-7hVhGnQR726S9GL6qT8bflBXBM,5383
28
28
  pykubegrader/widgets_base/select.py,sha256=Fw3uFNOIWo1a3CvlzSx23bvi6bSmA3TqutuRbhD4Dp8,2525
29
- PyKubeGrader-0.2.13.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
30
- PyKubeGrader-0.2.13.dist-info/METADATA,sha256=kKG8_Pma2DrHWtCtw-FrI5rEDvW3R5mVXljRVZUY5sI,2779
31
- PyKubeGrader-0.2.13.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
32
- PyKubeGrader-0.2.13.dist-info/entry_points.txt,sha256=UPMdTT46fQwTYJWtrUwIWIbXbwyOPfNQgBFRa0frWzw,138
33
- PyKubeGrader-0.2.13.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
34
- PyKubeGrader-0.2.13.dist-info/RECORD,,
29
+ PyKubeGrader-0.2.14.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
30
+ PyKubeGrader-0.2.14.dist-info/METADATA,sha256=VzXTZ6hT1t0xMjXeOjapWfNR14PKiE1YAQaYuWKelEI,2779
31
+ PyKubeGrader-0.2.14.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
32
+ PyKubeGrader-0.2.14.dist-info/entry_points.txt,sha256=UPMdTT46fQwTYJWtrUwIWIbXbwyOPfNQgBFRa0frWzw,138
33
+ PyKubeGrader-0.2.14.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
34
+ PyKubeGrader-0.2.14.dist-info/RECORD,,
@@ -567,6 +567,7 @@ class NotebookProcessor:
567
567
 
568
568
  # Make the code cell non-editable and non-deletable
569
569
  code_cell.metadata = {"editable": False, "deletable": False}
570
+ code_cell.metadata["tags"] = ["skip-execution"]
570
571
 
571
572
  # Add the cells to the notebook
572
573
  notebook.cells.append(markdown_cell)
@@ -1810,7 +1811,7 @@ def generate_select_many_file(data_dict, output_file="select_many_questions.py")
1810
1811
  )
1811
1812
  f.write(" def __init__(self):\n")
1812
1813
  f.write(" super().__init__(\n")
1813
- f.write(f" title=f'{q_value['question_text']}',\n")
1814
+ f.write(f' title=f"{q_value['question_text']}",\n')
1814
1815
  f.write(" style=MultiSelect,\n")
1815
1816
  f.write(
1816
1817
  f" question_number={q_value['question number']},\n"
@@ -1887,7 +1888,7 @@ def generate_tf_file(data_dict, output_file="tf_questions.py"):
1887
1888
  )
1888
1889
  f.write(" def __init__(self):\n")
1889
1890
  f.write(" super().__init__(\n")
1890
- f.write(f" title=f'{q_value['question_text']}',\n")
1891
+ f.write(f' title=f"{q_value['question_text']}",\n')
1891
1892
  f.write(" style=TFStyle,\n")
1892
1893
  f.write(
1893
1894
  f" question_number={q_value['question number']},\n"
@@ -1,26 +1,29 @@
1
1
  import requests
2
+ import os
3
+ import json
4
+
2
5
 
3
6
  try:
4
- from pykubegrader.build.passwords import password, user, juptyerhub_user
7
+ from pykubegrader.build.passwords import password, user
5
8
  except: # noqa: E722
6
9
  print("Passwords not found, cannot access database")
7
10
 
8
11
 
9
12
  def build_token_payload(token: str, duration: int) -> dict:
10
13
 
11
- if juptyerhub_user() is None:
14
+ if os.getenv("JUPYTERHUB_USER", None) is None:
12
15
  raise ValueError("JupyterHub user not found")
13
16
 
14
17
  # Return the extracted details as a dictionary
15
18
  return {
16
19
  "value": token,
17
- "requester": juptyerhub_user(),
20
+ "requester": os.getenv("JUPYTERHUB_USER", None),
18
21
  "duration": duration,
19
22
  }
20
23
 
21
24
 
22
25
  # Need to do for add token as well
23
- def add_token(self, token, duration=20):
26
+ def add_token(token, duration=20):
24
27
  """
25
28
  Sends a POST request to add a notebook.
26
29
  """
@@ -28,7 +31,7 @@ def add_token(self, token, duration=20):
28
31
  url = "https://engr-131-api.eastus.cloudapp.azure.com/tokens"
29
32
 
30
33
  # Build the payload
31
- payload = self.build_token_payload(token= token, duration=duration)
34
+ payload = build_token_payload(token=token, duration=duration)
32
35
 
33
36
  # Define HTTP Basic Authentication
34
37
  auth = (user(), password())
@@ -37,7 +40,7 @@ def add_token(self, token, duration=20):
37
40
  headers = {"Content-Type": "application/json"}
38
41
 
39
42
  # Serialize the payload with the custom JSON encoder
40
- serialized_payload = json.dumps(payload, default=self.json_serial)
43
+ serialized_payload = json.dumps(payload)
41
44
 
42
45
  # Send the POST request
43
46
  response = requests.post(url, data=serialized_payload, headers=headers, auth=auth)