summaryrefslogtreecommitdiff
path: root/octave_kernel.py
diff options
context:
space:
mode:
authorSteven Silvester2014-08-02 09:56:44 -0500
committerSteven Silvester2014-08-02 09:56:44 -0500
commitb5d83cdbde3d87eaefd746f1fe274c0da3392215 (patch)
tree6da50eec0ca1d8163dd5647415be4fc9191719d4 /octave_kernel.py
parent4e9d3bd4bd4593b3f746af1d172ed93ebe1ce85f (diff)
downloadscilab_kernel-b5d83cdbde3d87eaefd746f1fe274c0da3392215.tar.gz
scilab_kernel-b5d83cdbde3d87eaefd746f1fe274c0da3392215.tar.bz2
scilab_kernel-b5d83cdbde3d87eaefd746f1fe274c0da3392215.zip
Respect store_history, add docstrings
Diffstat (limited to 'octave_kernel.py')
-rw-r--r--octave_kernel.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/octave_kernel.py b/octave_kernel.py
index cbfb759..f02fe77 100644
--- a/octave_kernel.py
+++ b/octave_kernel.py
@@ -62,11 +62,12 @@ class OctaveKernel(Kernel):
def do_execute(self, code, silent, store_history=True,
user_expressions=None, allow_stdin=False):
+ """Execute a line of code in Octave."""
code = code.strip()
abort_msg = {'status': 'abort',
'execution_count': self.execution_count}
- if code:
+ if code and store_history:
self.cache.append(code)
if len(self.cache) > self.max_cache:
self.cache.pop(0)
@@ -121,6 +122,7 @@ class OctaveKernel(Kernel):
'payload': [], 'user_expressions': {}}
def do_complete(self, code, cursor_pos):
+ """Get code completions using Octave's 'completion_matches'"""
code = code[:cursor_pos]
default = {'matches': [], 'cursor_start': 0,
'cursor_end': cursor_pos, 'metadata': dict(),
@@ -158,6 +160,7 @@ class OctaveKernel(Kernel):
'status': 'ok'}
def do_inspect(self, code, cursor_pos, detail_level=0):
+ """If the code ends with a (, try to return a calltip docstring"""
data = dict()
if (not code or not len(code) >= cursor_pos or
not code[cursor_pos - 1] == '('):
@@ -172,7 +175,7 @@ class OctaveKernel(Kernel):
def do_history(self, hist_access_type, output, raw, session=None,
start=None, stop=None, n=None, pattern=None, unique=False):
- """Access history.
+ """Access history at startup.
"""
if not self.hist_file:
return {'history': []}
@@ -188,6 +191,8 @@ class OctaveKernel(Kernel):
return {'history': history}
def do_shutdown(self, restart):
+ """Shut down the app gracefully, saving history.
+ """
self.log.debug("**Shutting down")
if restart:
self.octavewrapper.restart()