Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Merge branch 'jupyter-working' into jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
jodiew committed Nov 23, 2019
2 parents 269ae60 + 6ee478c commit 7d74c3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions jupyter/seq_kernel/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {}
}
6 changes: 6 additions & 0 deletions jupyter/seq_kernel/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
}

0 comments on commit 7d74c3c

Please # to comment.