| | 2246 | if 'fakemodule' in filename.lower() and inspect.isclass(data): |
|---|
| | 2247 | # class created by %edit? Try to find source |
|---|
| | 2248 | # by looking for method definitions instead, the |
|---|
| | 2249 | # __module__ in those classes is FakeModule. |
|---|
| | 2250 | attrs = [getattr(data, aname) for aname in dir(data)] |
|---|
| | 2251 | for attr in attrs: |
|---|
| | 2252 | if not inspect.ismethod(attr): |
|---|
| | 2253 | continue |
|---|
| | 2254 | filename = inspect.getabsfile(attr) |
|---|
| | 2255 | if filename and 'fakemodule' not in filename.lower(): |
|---|
| | 2256 | # change the attribute to be the edit target instead |
|---|
| | 2257 | data = attr |
|---|
| | 2258 | break |
|---|
| | 2259 | |
|---|