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