Skip to content

Commit

Permalink
noqa on get_ipython
Browse files Browse the repository at this point in the history
fix_#34
  • Loading branch information
TheoMF committed Aug 8, 2023
1 parent 5066e1e commit cd3b0a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ repos:
rev: v0.0.282
hooks:
- id: ruff
exclude: gepetuto/magic.py
args:
- --fix
- --exit-non-zero-on-fix
Expand Down
12 changes: 8 additions & 4 deletions gepetuto/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class DoNotLoadMagics(Magics):
def do_not_load_snippet(self, line):
"""Magic command to hide the snippet and let the student code by themself."""
if DoNotLoadMagics.force_load:
get_ipython().run_line_magic("run", "-i " + line)
get_ipython().run_line_magic("load", line) # noqa: F821
self.run("run", "-i " + line)
self.run("load", line)

@line_magic
def force_load(self, line):
Expand All @@ -28,8 +28,12 @@ def force_load(self, line):
@line_magic
def load_snippet(self, line):
"""Magic command to load and run the snippet, this only work on JupyterLab."""
get_ipython().run_line_magic("run", "-i " + line)
get_ipython().run_line_magic("load", line)
self.run("run", "-i " + line)
self.run("load", line)

def run(self, magic, line):
"""Run magic command."""
get_ipython().run_line_magic(magic, line) # noqa: F821


ip = get_ipython() # noqa: F821
Expand Down

0 comments on commit cd3b0a0

Please sign in to comment.