Skip to content

Commit

Permalink
magic kernel: call do_function_direct
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Sep 13, 2014
1 parent f80e956 commit de851f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions eval_kernel/eval_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ def do_execute_direct(self, code):
python_magic = self.line_magics['python']
return python_magic.eval(code.strip())

def do_function_direct(self, function_name, arg):
"""
Call a function in the kernel language with args (as a single item).
"""
return python_magic.eval("%s(%s)" % (function_name, arg))

def get_completions(self, info):
python_magic = self.line_magics['python']
return python_magic.get_completions(info)
Expand Down
7 changes: 3 additions & 4 deletions jupyter_kernel/magickernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@ def do_execute_file(self, filename):
"""
self.Error("This language does not support \"%run filename\".")

def do_function_direct(self, function_name, args):
def do_function_direct(self, function_name, arg):
"""
Call a function in the kernel language with args (as a single item).
"""
#self.Error("This language does not support \"%pmap function args\".")
return (function_name, args)

self.Error("This language does not support \"%pmap function args\".")

def restart_kernel(self):
"""Restart the kernel"""
pass
Expand Down

0 comments on commit de851f3

Please sign in to comment.