Show More
@@ -42,6 +42,12 b' from IPython.utils.wildcard import list_namespace' | |||||
42 | from IPython.utils.coloransi import * |
|
42 | from IPython.utils.coloransi import * | |
43 | from IPython.utils.py3compat import cast_unicode, string_types |
|
43 | from IPython.utils.py3compat import cast_unicode, string_types | |
44 |
|
44 | |||
|
45 | # builtin docstrings to ignore | |||
|
46 | _func_call_docstring = types.FunctionType.__call__.__doc__ | |||
|
47 | _object_init_docstring = object.__init__.__doc__ | |||
|
48 | _builtin_type_docstrings = { | |||
|
49 | t.__doc__ for t in (types.ModuleType, types.MethodType, types.FunctionType) | |||
|
50 | } | |||
45 | #**************************************************************************** |
|
51 | #**************************************************************************** | |
46 | # Builtin color schemes |
|
52 | # Builtin color schemes | |
47 |
|
53 | |||
@@ -732,8 +738,8 b' class Inspector:' | |||||
732 | init_def = self._getdef(obj_init,oname) |
|
738 | init_def = self._getdef(obj_init,oname) | |
733 | init_ds = getdoc(obj_init) |
|
739 | init_ds = getdoc(obj_init) | |
734 | # Skip Python's auto-generated docstrings |
|
740 | # Skip Python's auto-generated docstrings | |
735 |
|
|
741 | print(init_ds) | |
736 | init_ds.startswith('x.__init__(...) initializes'): |
|
742 | if init_ds == _object_init_docstring: | |
737 | init_ds = None |
|
743 | init_ds = None | |
738 |
|
744 | |||
739 | if init_def or init_ds: |
|
745 | if init_def or init_ds: | |
@@ -756,10 +762,7 b' class Inspector:' | |||||
756 | else: |
|
762 | else: | |
757 | class_ds = getdoc(cls) |
|
763 | class_ds = getdoc(cls) | |
758 | # Skip Python's auto-generated docstrings |
|
764 | # Skip Python's auto-generated docstrings | |
759 |
if class_ds |
|
765 | if class_ds in _builtin_type_docstrings: | |
760 | (class_ds.startswith('function(code, globals[,') or \ |
|
|||
761 | class_ds.startswith('instancemethod(function, instance,') or \ |
|
|||
762 | class_ds.startswith('module(name[,') ): |
|
|||
763 | class_ds = None |
|
766 | class_ds = None | |
764 | if class_ds and ds != class_ds: |
|
767 | if class_ds and ds != class_ds: | |
765 | out['class_docstring'] = class_ds |
|
768 | out['class_docstring'] = class_ds | |
@@ -768,8 +771,7 b' class Inspector:' | |||||
768 | try: |
|
771 | try: | |
769 | init_ds = getdoc(obj.__init__) |
|
772 | init_ds = getdoc(obj.__init__) | |
770 | # Skip Python's auto-generated docstrings |
|
773 | # Skip Python's auto-generated docstrings | |
771 |
if init_ds |
|
774 | if init_ds == _object_init_docstring: | |
772 | init_ds.startswith('x.__init__(...) initializes'): |
|
|||
773 | init_ds = None |
|
775 | init_ds = None | |
774 | except AttributeError: |
|
776 | except AttributeError: | |
775 | init_ds = None |
|
777 | init_ds = None | |
@@ -783,7 +785,7 b' class Inspector:' | |||||
783 | out['call_def'] = self.format(call_def) |
|
785 | out['call_def'] = self.format(call_def) | |
784 | call_ds = getdoc(obj.__call__) |
|
786 | call_ds = getdoc(obj.__call__) | |
785 | # Skip Python's auto-generated docstrings |
|
787 | # Skip Python's auto-generated docstrings | |
786 | if call_ds and call_ds.startswith('x.__call__(...) <==> x(...)'): |
|
788 | if call_ds == _func_call_docstring: | |
787 | call_ds = None |
|
789 | call_ds = None | |
788 | if call_ds: |
|
790 | if call_ds: | |
789 | out['call_docstring'] = call_ds |
|
791 | out['call_docstring'] = call_ds |
General Comments 0
You need to be logged in to leave comments.
Login now