Show More
@@ -1168,7 +1168,7 b' class InteractiveShell(Configurable, Magic):' | |||||
1168 | if info.found: |
|
1168 | if info.found: | |
1169 | return self.inspector.info(info.obj, info=info) |
|
1169 | return self.inspector.info(info.obj, info=info) | |
1170 | else: |
|
1170 | else: | |
1171 | return {} |
|
1171 | return oinspect.mk_object_info({}) | |
1172 |
|
1172 | |||
1173 | #------------------------------------------------------------------------- |
|
1173 | #------------------------------------------------------------------------- | |
1174 | # Things related to history management |
|
1174 | # Things related to history management |
@@ -76,7 +76,7 b" info_fields = ['type_name', 'base_class', 'string_form', 'namespace'," | |||||
76 | 'call_def', 'call_docstring', |
|
76 | 'call_def', 'call_docstring', | |
77 | # These won't be printed but will be used to determine how to |
|
77 | # These won't be printed but will be used to determine how to | |
78 | # format the object |
|
78 | # format the object | |
79 | 'ismagic', 'isalias', |
|
79 | 'ismagic', 'isalias', 'argspec', 'found', | |
80 | ] |
|
80 | ] | |
81 |
|
81 | |||
82 |
|
82 | |||
@@ -162,7 +162,7 b' def getargspec(obj):' | |||||
162 | elif inspect.ismethod(obj): |
|
162 | elif inspect.ismethod(obj): | |
163 | func_obj = obj.im_func |
|
163 | func_obj = obj.im_func | |
164 | else: |
|
164 | else: | |
165 |
raise TypeError |
|
165 | raise TypeError('arg is not a Python function') | |
166 | args, varargs, varkw = inspect.getargs(func_obj.func_code) |
|
166 | args, varargs, varkw = inspect.getargs(func_obj.func_code) | |
167 | return args, varargs, varkw, func_obj.func_defaults |
|
167 | return args, varargs, varkw, func_obj.func_defaults | |
168 |
|
168 | |||
@@ -583,8 +583,9 b' class Inspector:' | |||||
583 | if formatter is not None: |
|
583 | if formatter is not None: | |
584 | ds = formatter(ds) |
|
584 | ds = formatter(ds) | |
585 |
|
585 | |||
586 | # store output in a dict, we'll later convert it to an ObjectInfo |
|
586 | # store output in a dict, we'll later convert it to an ObjectInfo. We | |
587 | out = {} |
|
587 | # initialize it here and fill it as we go | |
|
588 | out = dict(isalias=isalias, ismagic=ismagic) | |||
588 |
|
589 | |||
589 | string_max = 200 # max size of strings to show (snipped if longer) |
|
590 | string_max = 200 # max size of strings to show (snipped if longer) | |
590 | shalf = int((string_max -5)/2) |
|
591 | shalf = int((string_max -5)/2) | |
@@ -652,7 +653,10 b' class Inspector:' | |||||
652 | defln = self._getdef(obj,oname) |
|
653 | defln = self._getdef(obj,oname) | |
653 | if defln: |
|
654 | if defln: | |
654 | out['definition'] = self.format(defln) |
|
655 | out['definition'] = self.format(defln) | |
655 |
|
656 | args, varargs, varkw, func_defaults = getargspec(obj) | ||
|
657 | out['argspec'] = dict(args=args, varargs=varargs, | |||
|
658 | varkw=varkw, func_defaults=func_defaults) | |||
|
659 | ||||
656 | # Docstrings only in detail 0 mode, since source contains them (we |
|
660 | # Docstrings only in detail 0 mode, since source contains them (we | |
657 | # avoid repetitions). If source fails, we add them back, see below. |
|
661 | # avoid repetitions). If source fails, we add them back, see below. | |
658 | if ds and detail_level == 0: |
|
662 | if ds and detail_level == 0: |
@@ -389,7 +389,11 b' field names that IPython prints at the terminal.' | |||||
389 | Message type: ``object_info_reply``:: |
|
389 | Message type: ``object_info_reply``:: | |
390 |
|
390 | |||
391 | content = { |
|
391 | content = { | |
392 | # Flags for magics and system aliases |
|
392 | # Boolean flag indicating whether the named object was found or not. If | |
|
393 | # it's false, all other fields will be empty. | |||
|
394 | 'found' : bool, | |||
|
395 | ||||
|
396 | # Flags for magics and system aliases | |||
393 | 'ismagic' : bool, |
|
397 | 'ismagic' : bool, | |
394 | 'isalias' : bool, |
|
398 | 'isalias' : bool, | |
395 |
|
399 |
General Comments 0
You need to be logged in to leave comments.
Login now