Show More
@@ -72,7 +72,7 b' class MagicsDisplay(object):' | |||
|
72 | 72 | magic_dict[key] = d |
|
73 | 73 | for name, obj in subdict.items(): |
|
74 | 74 | try: |
|
75 |
classname = obj. |
|
|
75 | classname = obj.__self__.__class__.__name__ | |
|
76 | 76 | except AttributeError: |
|
77 | 77 | classname = 'Other' |
|
78 | 78 |
@@ -188,7 +188,7 b' def getargspec(obj):' | |||
|
188 | 188 | if inspect.isfunction(obj): |
|
189 | 189 | func_obj = obj |
|
190 | 190 | elif inspect.ismethod(obj): |
|
191 |
func_obj = obj. |
|
|
191 | func_obj = obj.__func__ | |
|
192 | 192 | elif hasattr(obj, '__call__'): |
|
193 | 193 | func_obj = obj.__call__ |
|
194 | 194 | else: |
@@ -834,9 +834,9 b' def test_multiple_magics():' | |||
|
834 | 834 | foo2 = FooFoo(ip) |
|
835 | 835 | mm = ip.magics_manager |
|
836 | 836 | mm.register(foo1) |
|
837 |
nt.assert_true(mm.magics['line']['foo']. |
|
|
837 | nt.assert_true(mm.magics['line']['foo'].__self__ is foo1) | |
|
838 | 838 | mm.register(foo2) |
|
839 |
nt.assert_true(mm.magics['line']['foo']. |
|
|
839 | nt.assert_true(mm.magics['line']['foo'].__self__ is foo2) | |
|
840 | 840 | |
|
841 | 841 | def test_alias_magic(): |
|
842 | 842 | """Test %alias_magic.""" |
@@ -196,7 +196,7 b' def findsource(object):' | |||
|
196 | 196 | raise IOError('could not find class definition') |
|
197 | 197 | |
|
198 | 198 | if ismethod(object): |
|
199 |
object = object. |
|
|
199 | object = object.__func__ | |
|
200 | 200 | if isfunction(object): |
|
201 | 201 | object = object.__code__ |
|
202 | 202 | if istraceback(object): |
@@ -308,7 +308,7 b' else:' | |||
|
308 | 308 | UPDATE_RULES.extend([(lambda a, b: isinstance2(a, b, types.ClassType), |
|
309 | 309 | update_class), |
|
310 | 310 | (lambda a, b: isinstance2(a, b, types.MethodType), |
|
311 |
lambda a, b: update_function(a. |
|
|
311 | lambda a, b: update_function(a.__func__, b.__func__)), | |
|
312 | 312 | ]) |
|
313 | 313 | |
|
314 | 314 |
@@ -109,7 +109,7 b' class DocTestFinder(doctest.DocTestFinder):' | |||
|
109 | 109 | # __module__ attribute of methods, but since the same error is easy |
|
110 | 110 | # to make by extension code writers, having this safety in place |
|
111 | 111 | # isn't such a bad idea |
|
112 |
return module.__name__ == object. |
|
|
112 | return module.__name__ == object.__self__.__class__.__module__ | |
|
113 | 113 | elif inspect.getmodule(object) is not None: |
|
114 | 114 | return module is inspect.getmodule(object) |
|
115 | 115 | elif hasattr(object, '__module__'): |
@@ -157,7 +157,7 b' class DocTestFinder(doctest.DocTestFinder):' | |||
|
157 | 157 | if isinstance(val, staticmethod): |
|
158 | 158 | val = getattr(obj, valname) |
|
159 | 159 | if isinstance(val, classmethod): |
|
160 |
val = getattr(obj, valname). |
|
|
160 | val = getattr(obj, valname).__func__ | |
|
161 | 161 | |
|
162 | 162 | # Recurse to methods, properties, and nested classes. |
|
163 | 163 | if ((inspect.isfunction(val) or inspect.isclass(val) or |
@@ -33,7 +33,7 b' def getargspec(obj):' | |||
|
33 | 33 | if inspect.isfunction(obj): |
|
34 | 34 | func_obj = obj |
|
35 | 35 | elif inspect.ismethod(obj): |
|
36 |
func_obj = obj. |
|
|
36 | func_obj = obj.__func__ | |
|
37 | 37 | else: |
|
38 | 38 | raise TypeError('arg is not a Python function') |
|
39 | 39 | args, varargs, varkw = inspect.getargs(func_obj.__code__) |
General Comments 0
You need to be logged in to leave comments.
Login now