def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_line_magic kernel = IPythonKernel() magic = DownloadMagic(kernel) # Make magics callable: kernel.line_magics["download"] = magic @register_line_magic def download(line): kernel.call_magic("%download " + line)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_line_magic kernel = IPythonKernel() magic = Prompt4VarMagic(kernel) # Make magics callable: kernel.line_magics["prompt4var"] = magic @register_line_magic def prompt4var(line): kernel.call_magic("%prompt4var " + line)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_line_magic kernel = IPythonKernel() magic = JigsawMagic(kernel) # Make magics callable: kernel.line_magics["jigsaw"] = magic @register_line_magic def jigsaw(line): """ Use the Jigsaw code visualizer and generator. """ kernel.call_magic("%jigsaw " + line)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_line_magic kernel = IPythonKernel() magic = BlocklyMagic(kernel) # Make magics callable: kernel.line_magics["blockly"] = magic @register_line_magic def blockly(line): """ Use the blockly code visualizer and generator. """ kernel.call_magic("%blockly " + line)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_cell_magic kernel = IPythonKernel() magic = DotMagic(kernel) # Make magics callable: kernel.cell_magics["dot"] = magic @register_cell_magic def dot(line, cell): """ %%dot - evaluate cell contents as a dot diagram. """ magic.code = cell kernel.call_magic(line)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_line_magic kernel = IPythonKernel() magic = logMagic(kernel) # Make magics callable: kernel.line_magics["showLog"] = magic kernel.line_magics["showFullLog"] = magic @register_line_magic def showLog(line): kernel.call_magic("%showLog " + line) @register_line_magic def showFullLog(line): kernel.call_magic("%showFullLog " + line)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_line_magic, register_cell_magic kernel = IPythonKernel() magic = KernelMagic(kernel) @register_line_magic def kernel(line): """ line is module_name, class_name[, kernel_name] """ if line.strip().count(" ") == 1: kernel_name = "default" module_name, class_name = [ item.strip() for item in line.strip().split(" ", 1) ] else: module_name, class_name, kernel_name = [ item.strip() for item in line.strip().split(" ", 2) ] magic.line_kernel(module_name, class_name, kernel_name) @register_cell_magic def kx(line, cell): """ line is kernel_name, or "default" """ if line.strip(): module_name = line.strip() else: module_name = "default" magic.code = cell magic.cell_kx(module_name)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_cell_magic kernel = IPythonKernel() magic = SimulationMagic(kernel) @register_cell_magic def simulation(line, cell): magic.code = cell magic.cell_simulation()
def register_ipython_magics(): from metakernel import IPythonKernel from metakernel.utils import add_docs from IPython.core.magic import register_line_magic, register_cell_magic kernel = IPythonKernel() magic = ActivityMagic(kernel) # Make magics callable: kernel.line_magics["activity"] = magic kernel.cell_magics["activity"] = magic @register_line_magic @add_docs(magic.line_activity.__doc__) def activity(line): kernel.call_magic("%activity " + line) @register_cell_magic @add_docs(magic.cell_activity.__doc__) def activity(line, cell): magic.code = cell magic.cell_activity(line)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_cell_magic kernel = IPythonKernel() magic = ProcessingMagic(kernel) @register_cell_magic def processing(line, cell): """ """ magic.code = cell magic.cell_processing()
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_cell_magic kernel = IPythonKernel() magic = DotMagic(kernel) @register_cell_magic def dot(line, cell): """ %%dot - evaluate cell contents as a dot diagram. """ magic.code = cell magic.cell_dot()
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_cell_magic kernel = IPythonKernel() magic = BrainMagic(kernel) @register_cell_magic def brain(line, cell): from IPython import get_ipython ipkernel = get_ipython() magic.code = cell magic.cell_brain() ipkernel.kernel.do_execute(magic.code, silent=True)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_line_magic, register_cell_magic kernel = IPythonKernel() magic = ConversationMagic(kernel) @register_line_magic def conversation(id): magic.line_conversation(id) @register_cell_magic def conversation(id, cell): magic.code = cell magic.cell_conversation(id)
def register_ipython_magics(): from metakernel import IPythonKernel from IPython.core.magic import register_line_magic, register_cell_magic kernel = IPythonKernel() magic = SchemeMagic(kernel) @register_line_magic def scheme(line): magic.line_scheme(line) return magic.retval @register_cell_magic def scheme(line, cell): magic.code = cell magic.cell_scheme() return magic.retval
def register_ipython_magics(): """For usage within ipykernel. This will instantiate the magics for IPython """ from metakernel import IPythonKernel from IPython.core.magic import register_cell_magic, register_line_cell_magic kernel = IPythonKernel() scala_magic = ScalaMagic(kernel) init_spark_magic = InitSparkMagic(kernel) @register_line_cell_magic def scala(line, cell): if line: return scala_magic.line_scala(line) else: scala_magic.code = cell return scala_magic.cell_scala() @register_cell_magic def init_spark(line, cell): init_spark_magic.code = cell return init_spark_magic.cell_init_spark()