PyKubeGrader 0.2.7__py3-none-any.whl → 0.2.9__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.7
3
+ Version: 0.2.9
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -29,6 +29,7 @@ Requires-Dist: types-pyyaml
29
29
  Requires-Dist: types-requests
30
30
  Requires-Dist: types-setuptools
31
31
  Requires-Dist: httpx
32
+ Requires-Dist: nest_asyncio
32
33
  Provides-Extra: testing
33
34
  Requires-Dist: setuptools; extra == "testing"
34
35
  Requires-Dist: pytest; extra == "testing"
@@ -12,7 +12,7 @@ pykubegrader/graders/late_assignments.py,sha256=_2-rA5RqO0BWY9WAQA_mbCxxPKTOiJOl
12
12
  pykubegrader/log_parser/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
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
- pykubegrader/submit/submit_assignment.py,sha256=DcaxSlW3yHQvp9dYJmL4wtwc9HGaCaHBHWw99GXxX98,2659
15
+ pykubegrader/submit/submit_assignment.py,sha256=-GaxZBFnZOcFYoWo_WcmLB0y7PQBRKnSlhUAhg3zwMs,3002
16
16
  pykubegrader/widgets/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
17
17
  pykubegrader/widgets/multiple_choice.py,sha256=NjD3-uXSnibpUQ0mO3hRp_O-rynFyl0Dz6IXE4tnCRI,2078
18
18
  pykubegrader/widgets/reading_question.py,sha256=y30_swHwzH8LrT8deWTnxctAAmR8BSxTlXAqMgUrAT4,3031
@@ -25,9 +25,9 @@ pykubegrader/widgets_base/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-
25
25
  pykubegrader/widgets_base/multi_select.py,sha256=Cl0IN21wXLZuFu-zC65aS9tD4jMfzCRJ2DPjHao5_Ak,4044
26
26
  pykubegrader/widgets_base/reading.py,sha256=_vjUPynqmJe_R4vf-7hVhGnQR726S9GL6qT8bflBXBM,5383
27
27
  pykubegrader/widgets_base/select.py,sha256=Fw3uFNOIWo1a3CvlzSx23bvi6bSmA3TqutuRbhD4Dp8,2525
28
- PyKubeGrader-0.2.7.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
29
- PyKubeGrader-0.2.7.dist-info/METADATA,sha256=-sUexmOPsmqakDBCt6iyjtAGvZLCuJrNdfrubGl5fvA,2750
30
- PyKubeGrader-0.2.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
31
- PyKubeGrader-0.2.7.dist-info/entry_points.txt,sha256=UPMdTT46fQwTYJWtrUwIWIbXbwyOPfNQgBFRa0frWzw,138
32
- PyKubeGrader-0.2.7.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
33
- PyKubeGrader-0.2.7.dist-info/RECORD,,
28
+ PyKubeGrader-0.2.9.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
29
+ PyKubeGrader-0.2.9.dist-info/METADATA,sha256=lZjDfx25WYOa1lLNTbejsN4WzBagrI_bqv1CWtkltUc,2778
30
+ PyKubeGrader-0.2.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
31
+ PyKubeGrader-0.2.9.dist-info/entry_points.txt,sha256=UPMdTT46fQwTYJWtrUwIWIbXbwyOPfNQgBFRa0frWzw,138
32
+ PyKubeGrader-0.2.9.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
33
+ PyKubeGrader-0.2.9.dist-info/RECORD,,
@@ -1,6 +1,10 @@
1
1
  import os
2
2
  import httpx
3
3
  import asyncio
4
+ import nest_asyncio
5
+
6
+ # Apply nest_asyncio for environments like Jupyter
7
+ nest_asyncio.apply()
4
8
 
5
9
 
6
10
  def get_credentials():
@@ -60,7 +64,6 @@ async def call_score_assignment(
60
64
  raise RuntimeError(f"An unexpected error occurred: {e}")
61
65
 
62
66
 
63
- # Importable function
64
67
  def submit_assignment(
65
68
  assignment_title: str, file_path: str = ".output_reduced.log"
66
69
  ) -> None:
@@ -71,7 +74,17 @@ def submit_assignment(
71
74
  assignment_title (str): Title of the assignment.
72
75
  file_path (str): Path to the log file to upload.
73
76
  """
74
- response = asyncio.run(call_score_assignment(assignment_title, file_path))
77
+ # Get the current event loop or create one
78
+ try:
79
+ loop = asyncio.get_event_loop()
80
+ except RuntimeError:
81
+ loop = asyncio.new_event_loop()
82
+ asyncio.set_event_loop(loop)
83
+
84
+ # Run the async function in the event loop
85
+ response = loop.run_until_complete(
86
+ call_score_assignment(assignment_title, file_path)
87
+ )
75
88
  print("Server Response:", response.get("message", "No message in response"))
76
89
 
77
90