##// END OF EJS Templates
add detail_level to object_info requests...
MinRK -
Show More
@@ -1456,11 +1456,13 b' class InteractiveShell(SingletonConfigurable, Magic):'
1456 print 'Object `%s` not found.' % oname
1456 print 'Object `%s` not found.' % oname
1457 return 'not found' # so callers can take other action
1457 return 'not found' # so callers can take other action
1458
1458
1459 def object_inspect(self, oname):
1459 def object_inspect(self, oname, detail_level=0):
1460 with self.builtin_trap:
1460 with self.builtin_trap:
1461 info = self._object_find(oname)
1461 info = self._object_find(oname)
1462 if info.found:
1462 if info.found:
1463 return self.inspector.info(info.obj, oname, info=info)
1463 return self.inspector.info(info.obj, oname, info=info,
1464 detail_level=detail_level
1465 )
1464 else:
1466 else:
1465 return oinspect.object_info(name=oname, found=False)
1467 return oinspect.object_info(name=oname, found=False)
1466
1468
@@ -364,7 +364,10 b' class Kernel(Configurable):'
364 self.log.debug(str(completion_msg))
364 self.log.debug(str(completion_msg))
365
365
366 def object_info_request(self, ident, parent):
366 def object_info_request(self, ident, parent):
367 object_info = self.shell.object_inspect(parent['content']['oname'])
367 content = parent['content']
368 object_info = self.shell.object_inspect(content['oname'],
369 detail_level = content.get('detail_level', 0)
370 )
368 # Before we send this object over, we scrub it for JSON usage
371 # Before we send this object over, we scrub it for JSON usage
369 oinfo = json_clean(object_info)
372 oinfo = json_clean(object_info)
370 msg = self.session.send(self.shell_socket, 'object_info_reply',
373 msg = self.session.send(self.shell_socket, 'object_info_reply',
@@ -297,19 +297,21 b' class ShellSocketChannel(ZMQSocketChannel):'
297 self._queue_send(msg)
297 self._queue_send(msg)
298 return msg['header']['msg_id']
298 return msg['header']['msg_id']
299
299
300 def object_info(self, oname):
300 def object_info(self, oname, detail_level=0):
301 """Get metadata information about an object.
301 """Get metadata information about an object.
302
302
303 Parameters
303 Parameters
304 ----------
304 ----------
305 oname : str
305 oname : str
306 A string specifying the object name.
306 A string specifying the object name.
307 detail_level : int, optional
308 The level of detail for the introspection (0-2)
307
309
308 Returns
310 Returns
309 -------
311 -------
310 The msg_id of the message sent.
312 The msg_id of the message sent.
311 """
313 """
312 content = dict(oname=oname)
314 content = dict(oname=oname, detail_level=detail_level)
313 msg = self.session.msg('object_info_request', content)
315 msg = self.session.msg('object_info_request', content)
314 self._queue_send(msg)
316 self._queue_send(msg)
315 return msg['header']['msg_id']
317 return msg['header']['msg_id']
General Comments 0
You need to be logged in to leave comments. Login now