diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 14beee8..b7e93db 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -1456,11 +1456,13 @@ class InteractiveShell(SingletonConfigurable, Magic): print 'Object `%s` not found.' % oname return 'not found' # so callers can take other action - def object_inspect(self, oname): + def object_inspect(self, oname, detail_level=0): with self.builtin_trap: info = self._object_find(oname) if info.found: - return self.inspector.info(info.obj, oname, info=info) + return self.inspector.info(info.obj, oname, info=info, + detail_level=detail_level + ) else: return oinspect.object_info(name=oname, found=False) diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 413d7c2..3164d4a 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -364,7 +364,10 @@ class Kernel(Configurable): self.log.debug(str(completion_msg)) def object_info_request(self, ident, parent): - object_info = self.shell.object_inspect(parent['content']['oname']) + content = parent['content'] + object_info = self.shell.object_inspect(content['oname'], + detail_level = content.get('detail_level', 0) + ) # Before we send this object over, we scrub it for JSON usage oinfo = json_clean(object_info) msg = self.session.send(self.shell_socket, 'object_info_reply', diff --git a/IPython/zmq/kernelmanager.py b/IPython/zmq/kernelmanager.py index f531a40..974b3fe 100644 --- a/IPython/zmq/kernelmanager.py +++ b/IPython/zmq/kernelmanager.py @@ -297,19 +297,21 @@ class ShellSocketChannel(ZMQSocketChannel): self._queue_send(msg) return msg['header']['msg_id'] - def object_info(self, oname): + def object_info(self, oname, detail_level=0): """Get metadata information about an object. Parameters ---------- oname : str A string specifying the object name. + detail_level : int, optional + The level of detail for the introspection (0-2) Returns ------- The msg_id of the message sent. """ - content = dict(oname=oname) + content = dict(oname=oname, detail_level=detail_level) msg = self.session.msg('object_info_request', content) self._queue_send(msg) return msg['header']['msg_id']