Show More
@@ -22,7 +22,7 b' import os' | |||||
22 | from textwrap import dedent |
|
22 | from textwrap import dedent | |
23 | import types |
|
23 | import types | |
24 | import io as stdlib_io |
|
24 | import io as stdlib_io | |
25 |
from itertools import zip_longest |
|
25 | from itertools import zip_longest | |
26 |
|
26 | |||
27 | # IPython's own |
|
27 | # IPython's own | |
28 | from IPython.core import page |
|
28 | from IPython.core import page | |
@@ -203,7 +203,7 b' def is_simple_callable(obj):' | |||||
203 | def getargspec(obj): |
|
203 | def getargspec(obj): | |
204 | """Wrapper around :func:`inspect.getfullargspec` on Python 3, and |
|
204 | """Wrapper around :func:`inspect.getfullargspec` on Python 3, and | |
205 | :func:inspect.getargspec` on Python 2. |
|
205 | :func:inspect.getargspec` on Python 2. | |
206 |
|
206 | |||
207 | In addition to functions and methods, this can also handle objects with a |
|
207 | In addition to functions and methods, this can also handle objects with a | |
208 | ``__call__`` attribute. |
|
208 | ``__call__`` attribute. | |
209 | """ |
|
209 | """ | |
@@ -327,7 +327,7 b' def find_source_lines(obj):' | |||||
327 | The line number where the object definition starts. |
|
327 | The line number where the object definition starts. | |
328 | """ |
|
328 | """ | |
329 | obj = _get_wrapped(obj) |
|
329 | obj = _get_wrapped(obj) | |
330 |
|
330 | |||
331 | try: |
|
331 | try: | |
332 | try: |
|
332 | try: | |
333 | lineno = inspect.getsourcelines(obj)[1] |
|
333 | lineno = inspect.getsourcelines(obj)[1] | |
@@ -582,7 +582,7 b' class Inspector(Colorable):' | |||||
582 |
|
582 | |||
583 | def _get_info(self, obj, oname='', formatter=None, info=None, detail_level=0): |
|
583 | def _get_info(self, obj, oname='', formatter=None, info=None, detail_level=0): | |
584 | """Retrieve an info dict and format it. |
|
584 | """Retrieve an info dict and format it. | |
585 |
|
585 | |||
586 | Parameters |
|
586 | Parameters | |
587 | ========== |
|
587 | ========== | |
588 |
|
588 | |||
@@ -639,6 +639,7 b' class Inspector(Colorable):' | |||||
639 |
|
639 | |||
640 | append_field(_mime, 'File', 'file') |
|
640 | append_field(_mime, 'File', 'file') | |
641 | append_field(_mime, 'Type', 'type_name') |
|
641 | append_field(_mime, 'Type', 'type_name') | |
|
642 | append_field(_mime, 'Subclasses', 'subclasses') | |||
642 |
|
643 | |||
643 | else: |
|
644 | else: | |
644 | # General Python objects |
|
645 | # General Python objects | |
@@ -653,7 +654,7 b' class Inspector(Colorable):' | |||||
653 |
|
654 | |||
654 | append_field(_mime, 'Length', 'length') |
|
655 | append_field(_mime, 'Length', 'length') | |
655 | append_field(_mime, 'File', 'file') |
|
656 | append_field(_mime, 'File', 'file') | |
656 |
|
657 | |||
657 | # Source or docstring, depending on detail level and whether |
|
658 | # Source or docstring, depending on detail level and whether | |
658 | # source found. |
|
659 | # source found. | |
659 | if detail_level > 0 and info['source']: |
|
660 | if detail_level > 0 and info['source']: | |
@@ -664,7 +665,7 b' class Inspector(Colorable):' | |||||
664 | append_field(_mime, 'Class docstring', 'class_docstring', formatter) |
|
665 | append_field(_mime, 'Class docstring', 'class_docstring', formatter) | |
665 | append_field(_mime, 'Init docstring', 'init_docstring', formatter) |
|
666 | append_field(_mime, 'Init docstring', 'init_docstring', formatter) | |
666 | append_field(_mime, 'Call docstring', 'call_docstring', formatter) |
|
667 | append_field(_mime, 'Call docstring', 'call_docstring', formatter) | |
667 |
|
668 | |||
668 |
|
669 | |||
669 | return self.format_mime(_mime) |
|
670 | return self.format_mime(_mime) | |
670 |
|
671 | |||
@@ -859,6 +860,9 b' class Inspector(Colorable):' | |||||
859 | if init_ds: |
|
860 | if init_ds: | |
860 | out['init_docstring'] = init_ds |
|
861 | out['init_docstring'] = init_ds | |
861 |
|
862 | |||
|
863 | names = [sub.__name__ for sub in obj.__subclasses__()] | |||
|
864 | all_names = ', '.join(names) | |||
|
865 | out['subclasses'] = all_names | |||
862 | # and class docstring for instances: |
|
866 | # and class docstring for instances: | |
863 | else: |
|
867 | else: | |
864 | # reconstruct the function definition and print it: |
|
868 | # reconstruct the function definition and print it: |
General Comments 0
You need to be logged in to leave comments.
Login now