diff --git a/jupyter/seq_kernel/kernel.py b/jupyter/seq_kernel/kernel.py index d368e8bf0..47ab9f008 100644 --- a/jupyter/seq_kernel/kernel.py +++ b/jupyter/seq_kernel/kernel.py @@ -63,3 +63,18 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None, al return {'status': 'ok', 'execution_count': self.execution_count, 'payload': [], 'user_expressions': {}} + + def _get_object(self, code, cursor_pos): + # TODO: Get the correct section of code to be inspected + left = code[:cursor_pos].rsplit(' ', 1)[-1] + right = code[cursor_pos:].split(' ', 1)[0] + return left + right + + def do_inspect(self, code, cursor_pos, detail_level=0): + data = self.seqwrapper.inspect(self._get_object(code, cursor_pos), detail_level) + return { + 'status': 'ok', + 'found': True, + 'data': data, + 'metadata': {} + } diff --git a/jupyter/seq_kernel/wrapper.py b/jupyter/seq_kernel/wrapper.py index 6b48efd2c..831308860 100644 --- a/jupyter/seq_kernel/wrapper.py +++ b/jupyter/seq_kernel/wrapper.py @@ -13,3 +13,9 @@ def __init__(self): def exec(self, code): self._exec_fn(self.handle, code.encode('utf-8')) + + def inspect(self, request_object, detail_level): + # TODO: Inspect the requested object and return the doc and/or source + return { + 'text/plain': f'Hello, World! {request_object} {detail_level}' + }