dlai-grader 1.21.0__py3-none-any.whl → 1.21.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dlai-grader might be problematic. Click here for more details.

dlai_grader/__init__.py CHANGED
@@ -6,6 +6,6 @@ from . import grading
6
6
  from . import types
7
7
 
8
8
 
9
- __version__ = "1.21.0"
9
+ __version__ = "1.21.2"
10
10
  __author__ = "Andres Zarta"
11
11
  __credits__ = "DeepLearning.AI"
dlai_grader/compiler.py CHANGED
@@ -40,6 +40,8 @@ def compile_partial_module(
40
40
  notebook: NotebookNode,
41
41
  module_name: str,
42
42
  verbose: bool = True,
43
+ exit_on_error: bool = False,
44
+ debug_mode: bool = False,
43
45
  ) -> ModuleType:
44
46
  """Iterates over the code cells of a notebook and includes the ones that run to the compiled module.
45
47
  Args:
@@ -60,10 +62,17 @@ def compile_partial_module(
60
62
  exec(compiled_code, module.__dict__)
61
63
 
62
64
  except Exception as e:
63
- if verbose:
65
+ if exit_on_error:
66
+ if debug_mode:
67
+ print(
68
+ f"Error during execution of cell. Aborting full compilation.\n\nContents:\n\n{cell_code}\n\nException:\n\n{e}\n"
69
+ )
70
+ break
71
+
72
+ if debug_mode:
64
73
  print(
65
- f"Error during execution of cell. Aborting full compilation.\n\nContents:\n\n{cell_code}\n\nException:\n\n{e}\n"
74
+ f"Error during execution of cell but kept going.\n\nContents:\n\n{cell_code}\n\nException:\n\n{e}\n"
66
75
  )
67
- break
76
+ continue
68
77
 
69
78
  return module
dlai_grader/templates.py CHANGED
@@ -218,8 +218,7 @@ def load_templates() -> Dict[str, str]:
218
218
  for t in transformations:
219
219
  solution_nb = t(solution_nb)
220
220
 
221
- solution_script = notebook_to_script(solution_nb)
222
- solution_mod = compile_module(solution_script, "solution_mod", verbose=False)
221
+ solution_mod = compile_partial_module(solution_nb, "solution_mod", verbose=False)
223
222
 
224
223
  g_func = handle_part_id(c.part_id)(learner_mod, solution_mod)
225
224
 
@@ -239,7 +238,7 @@ def load_templates() -> Dict[str, str]:
239
238
 
240
239
  send_feedback(
241
240
  0.0,
242
- f"Object required for grading not found. If you haven't completed the exercise this is expected. Otherwise, check your solution as grader omits cells that throw errors.\n{additional_msg}",
241
+ f"Object required for grading not found. If you haven't completed the exercise this is expected. Otherwise, check your solution as grader omits cells that throw errors.\\n{additional_msg}",
243
242
  err=True,
244
243
  )
245
244
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dlai-grader
3
- Version: 1.21.0
3
+ Version: 1.21.2
4
4
  Summary: Grading utilities for DLAI courses
5
5
  Home-page: https://github.com/https-deeplearning-ai/grader
6
6
  Author: Andres Zarta
@@ -1,16 +1,16 @@
1
- dlai_grader/__init__.py,sha256=YwnDeHfbUUK5KqiAGzDNf_Zm3CvLxy12XuzAL1hyrrA,211
1
+ dlai_grader/__init__.py,sha256=bjklEpR9B8-lHDwGGHlmv-prwjuze-EG437Nq5X7ydE,211
2
2
  dlai_grader/cli.py,sha256=NIwboE-AFn1LXOFmF4O70Ow0fkRxgclG_eMwmWiua38,4917
3
- dlai_grader/compiler.py,sha256=VuFWHXWlOLYuZgNHOm19Ef7hbWQX7kdAwk8auBAxsYs,2506
3
+ dlai_grader/compiler.py,sha256=ob-gIzTcqVVwER55H-gNdZogNxW50ETCguiuy3oNPps,2833
4
4
  dlai_grader/config.py,sha256=HQ3dzaFpRswIA_7EC8XdP8DdJH-XePsbMQMHG8Esblc,1638
5
5
  dlai_grader/grading.py,sha256=Gmft9b7M8At_y_WZDatYdW6tinZMfqQoT7bDXp6uz2I,4606
6
6
  dlai_grader/io.py,sha256=TB9d01AK5FIbFUQwM8AqOOfuMWzjzrit98i3MhK5AqU,8234
7
7
  dlai_grader/notebook.py,sha256=noMU6DzPVylSjkHmSBUcmquVvAz4JigbRtbQrVYJdic,11830
8
8
  dlai_grader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- dlai_grader/templates.py,sha256=zDLueSS6E6RbCY36sMyQFZ0RedBfsImi9ybBIk6JtBg,7903
9
+ dlai_grader/templates.py,sha256=JDDPoFm13pqRIOwSpt5kXXtMUM7jOv2Uyz1ap8KWu4I,7850
10
10
  dlai_grader/types.py,sha256=_IIVbYL9cMmwA6in0aI5fEWCIaAMNcQbxG64X1P1CkE,335
11
- dlai_grader-1.21.0.dist-info/LICENSE,sha256=a_kch_UqdJPtyxk35QJr9O84K_koPixqWPYW9On4-io,1072
12
- dlai_grader-1.21.0.dist-info/METADATA,sha256=vvZKID0w9qu46d0tPqwsjek-YP480jiKrYcbVOoGuII,8618
13
- dlai_grader-1.21.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
14
- dlai_grader-1.21.0.dist-info/entry_points.txt,sha256=4OcSAUIluONXa3ymViQ7CBQ2Lk52nb6xZnfph1rlMnk,71
15
- dlai_grader-1.21.0.dist-info/top_level.txt,sha256=4YKtA3ztisFtx_g4hsGivy3J2NHnXxFziIMqawC8HWg,12
16
- dlai_grader-1.21.0.dist-info/RECORD,,
11
+ dlai_grader-1.21.2.dist-info/LICENSE,sha256=a_kch_UqdJPtyxk35QJr9O84K_koPixqWPYW9On4-io,1072
12
+ dlai_grader-1.21.2.dist-info/METADATA,sha256=FIVXvgMev0R7OQkB-A1gFOufJ4O5iypU_f2ue-Q4KTo,8618
13
+ dlai_grader-1.21.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
14
+ dlai_grader-1.21.2.dist-info/entry_points.txt,sha256=4OcSAUIluONXa3ymViQ7CBQ2Lk52nb6xZnfph1rlMnk,71
15
+ dlai_grader-1.21.2.dist-info/top_level.txt,sha256=4YKtA3ztisFtx_g4hsGivy3J2NHnXxFziIMqawC8HWg,12
16
+ dlai_grader-1.21.2.dist-info/RECORD,,