Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to inspection machinery for magics #1845

Merged
merged 4 commits into from Jun 11, 2012
Merged

Conversation

fperez
Copy link
Member

@fperez fperez commented Jun 4, 2012

Now that magics are generated via decorators, the inspection machinery wasn't finding data about them such as source code. Fixes that along with some refactoring, cleanup and test additions.

Closes gh-1799.

Refactored some of the oinspect logic into standalone functions and
added tests.
@takluyver
Copy link
Member

From the looks of this, you're taking a conservative approach - only referring to __wrapped__ if you can't find the file of the original object. When we looked at this before, we referred to __wrapped__ if it existed at all - see the code in getsource(). The rationale was that the original function is generally more interesting than the decorator.

Whichever way we prefer, we should probably make it consistent.

@fperez
Copy link
Member Author

fperez commented Jun 4, 2012

Good point, I'll change it to go with our previous reasoning, I agree with it. Thanks for the review, I'll update as soon as I have a minute.

@ellisonbg
Copy link
Member

Once you make the changes, I think this can be merged.

@fperez
Copy link
Member Author

fperez commented Jun 8, 2012

Will do, thanks for the review...

@fperez
Copy link
Member Author

fperez commented Jun 11, 2012

OK, thanks for the review guys. I made the suggested changes, and added extra tests to validate that we really access __wrapped__ correctly. Merging now.

fperez added a commit that referenced this pull request Jun 11, 2012
Fixes to inspection machinery for magics

Now that magics are generated via decorators, the inspection machinery wasn't finding data about them such as source code. Fixes that along with some refactoring, cleanup and test additions.

Closes gh-1799.
@fperez fperez merged commit 44b8121 into ipython:master Jun 11, 2012
@tkf
Copy link
Contributor

tkf commented Jun 11, 2012

The %edit command does not use the improved code in this PR, right? Any plan for doing that?

@fperez
Copy link
Member Author

fperez commented Jun 11, 2012

I just missed that fact, refactoring PR welcome!

@tkf
Copy link
Contributor

tkf commented Jun 11, 2012

I tried: #1919

@fperez
Copy link
Member Author

fperez commented Jun 11, 2012

Great, merged.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Fixes to inspection machinery for magics

Now that magics are generated via decorators, the inspection machinery wasn't finding data about them such as source code. Fixes that along with some refactoring, cleanup and test additions.

Closes ipythongh-1799.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source file not found for magics
4 participants