##// END OF EJS Templates
If object has a getdoc() method, override its normal docstring....
Thomas Kluyver -
Show More
@@ -97,26 +97,22 b' def getdoc(obj):'
97 97 It also attempts to call a getdoc() method on the given object. This
98 98 allows objects which provide their docstrings via non-standard mechanisms
99 99 (like Pyro proxies) to still be inspected by ipython's ? system."""
100
101 ds = None # default return value
102 try:
103 ds = inspect.getdoc(obj)
104 except:
105 # Harden against an inspect failure, which can occur with
106 # SWIG-wrapped extensions.
107 pass
108 100 # Allow objects to offer customized documentation via a getdoc method:
109 101 try:
110 ds2 = obj.getdoc()
111 except:
102 ds = obj.getdoc()
103 except Exception:
112 104 pass
113 105 else:
114 106 # if we get extra info, we add it to the normal docstring.
115 if ds is None:
116 ds = ds2
117 else:
118 ds = '%s\n%s' % (ds,ds2)
119 return ds
107 if isinstance(ds, basestring):
108 return ds
109
110 try:
111 return inspect.getdoc(obj)
112 except Exception:
113 # Harden against an inspect failure, which can occur with
114 # SWIG-wrapped extensions.
115 return None
120 116
121 117
122 118 def getsource(obj,is_binary=False):
General Comments 0
You need to be logged in to leave comments. Login now