File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ class DoNotLoadMagics(Magics):
9
9
force_load = False
10
10
11
11
@line_magic
12
- def do_not_load (self , line ):
12
+ def do_not_load_snippet (self , line ):
13
13
"""Magic command to hide the snippet and let the student code by themself."""
14
14
if DoNotLoadMagics .force_load :
15
+ get_ipython ().run_line_magic ("run" , "-i " + line )
15
16
get_ipython ().run_line_magic ("load" , line ) # noqa: F821
16
17
17
18
@line_magic
@@ -24,6 +25,12 @@ def force_load(self, line):
24
25
DoNotLoadMagics .force_load = False
25
26
print ("Force load is OFF" )
26
27
28
+ @line_magic
29
+ def load_snippet (self , line ):
30
+ """Magic command to load and run the snippet, this only work on JupyterLab."""
31
+ get_ipython ().run_line_magic ("run" , "-i " + line )
32
+ get_ipython ().run_line_magic ("load" , line )
33
+
27
34
28
35
ip = get_ipython () # noqa: F821
29
36
ip .register_magics (DoNotLoadMagics )
You can’t perform that action at this time.
0 commit comments