Show More
@@ -41,6 +41,13 b' from IPython.utils.wildcard import list_namespace' | |||||
41 | from IPython.utils.coloransi import * |
|
41 | from IPython.utils.coloransi import * | |
42 | from IPython.utils.py3compat import cast_unicode |
|
42 | from IPython.utils.py3compat import cast_unicode | |
43 |
|
43 | |||
|
44 | # builtin docstrings to ignore | |||
|
45 | _func_call_docstring = types.FunctionType.__call__.__doc__ | |||
|
46 | _object_init_docstring = object.__init__.__doc__ | |||
|
47 | _builtin_type_docstrings = { | |||
|
48 | t.__doc__ for t in (types.ModuleType, types.MethodType, types.FunctionType) | |||
|
49 | } | |||
|
50 | ||||
44 | #**************************************************************************** |
|
51 | #**************************************************************************** | |
45 | # Builtin color schemes |
|
52 | # Builtin color schemes | |
46 |
|
53 | |||
@@ -741,8 +748,7 b' class Inspector:' | |||||
741 | init_def = self._getdef(obj_init,oname) |
|
748 | init_def = self._getdef(obj_init,oname) | |
742 | init_ds = getdoc(obj_init) |
|
749 | init_ds = getdoc(obj_init) | |
743 | # Skip Python's auto-generated docstrings |
|
750 | # Skip Python's auto-generated docstrings | |
744 |
if init_ds |
|
751 | if init_ds == _object_init_docstring: | |
745 | init_ds.startswith('x.__init__(...) initializes'): |
|
|||
746 | init_ds = None |
|
752 | init_ds = None | |
747 |
|
753 | |||
748 | if init_def or init_ds: |
|
754 | if init_def or init_ds: | |
@@ -765,10 +771,7 b' class Inspector:' | |||||
765 | else: |
|
771 | else: | |
766 | class_ds = getdoc(cls) |
|
772 | class_ds = getdoc(cls) | |
767 | # Skip Python's auto-generated docstrings |
|
773 | # Skip Python's auto-generated docstrings | |
768 |
if class_ds |
|
774 | if class_ds in _builtin_type_docstrings: | |
769 | (class_ds.startswith('function(code, globals[,') or \ |
|
|||
770 | class_ds.startswith('instancemethod(function, instance,') or \ |
|
|||
771 | class_ds.startswith('module(name[,') ): |
|
|||
772 | class_ds = None |
|
775 | class_ds = None | |
773 | if class_ds and ds != class_ds: |
|
776 | if class_ds and ds != class_ds: | |
774 | out['class_docstring'] = class_ds |
|
777 | out['class_docstring'] = class_ds | |
@@ -777,8 +780,7 b' class Inspector:' | |||||
777 | try: |
|
780 | try: | |
778 | init_ds = getdoc(obj.__init__) |
|
781 | init_ds = getdoc(obj.__init__) | |
779 | # Skip Python's auto-generated docstrings |
|
782 | # Skip Python's auto-generated docstrings | |
780 |
if init_ds |
|
783 | if init_ds == _object_init_docstring: | |
781 | init_ds.startswith('x.__init__(...) initializes'): |
|
|||
782 | init_ds = None |
|
784 | init_ds = None | |
783 | except AttributeError: |
|
785 | except AttributeError: | |
784 | init_ds = None |
|
786 | init_ds = None | |
@@ -792,7 +794,7 b' class Inspector:' | |||||
792 | out['call_def'] = self.format(call_def) |
|
794 | out['call_def'] = self.format(call_def) | |
793 | call_ds = getdoc(obj.__call__) |
|
795 | call_ds = getdoc(obj.__call__) | |
794 | # Skip Python's auto-generated docstrings |
|
796 | # Skip Python's auto-generated docstrings | |
795 | if call_ds and call_ds.startswith('x.__call__(...) <==> x(...)'): |
|
797 | if call_ds == _func_call_docstring: | |
796 | call_ds = None |
|
798 | call_ds = None | |
797 | if call_ds: |
|
799 | if call_ds: | |
798 | out['call_docstring'] = call_ds |
|
800 | out['call_docstring'] = call_ds |
General Comments 0
You need to be logged in to leave comments.
Login now