-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debug magic: protection when running code in another cell; added show…
… magic - puts data into pager area; removed debug info
- Loading branch information
Showing
2 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) Calico Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
# http://calicoproject.org/ | ||
|
||
from jupyter_kernel import Magic, option | ||
import os | ||
|
||
class ShowMagic(Magic): | ||
|
||
def cell_show(self): | ||
""" | ||
%%show - load cell contents into system pager | ||
This cell magic will put the contents the cell into | ||
the system pager. | ||
Example: | ||
%%show | ||
This information will appear in the pager. | ||
""" | ||
self.kernel.payload = [{"data": {"text/plain": self.code}, | ||
"start_line_number": 0, | ||
"source": "page"}] | ||
self.evaluate = False | ||
|
||
def register_magics(kernel): | ||
kernel.register_magics(ShowMagic) | ||
|