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
Add 'quiet' option to suppress screen output during %prun calls, edited dochelp #1210
Conversation
…tput in the pager. Edited dochelp as well.
This looks pretty good to me, though I would prefer it without the extra whitespace changes. |
@@ -1438,7 +1440,8 @@ def magic_prun(self, parameter_s ='',user_mode=1, | |||
output = stdout_trap.getvalue() | |||
output = output.rstrip() | |||
|
|||
page.page(output) | |||
if not opts.has_key('q'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The has_key method is deprecated - we should use if 'q' not in opts
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing it to if not 'q' in opts is fine by me- i initially coded it like
this, and then noticed that the 'r' option is parsed like this, so I
changed it to match. We should probably change both.
I can double check and look for extraneous whitespace.
What is the best way to proceed? (I'm new to this- first contrib!) Do I
recommit and then do another pull request?
cheers,
ag
On Tue, Dec 27, 2011 at 07:23, Thomas <
reply@reply.github.com
wrote:
@@ -1438,7 +1440,8 @@ def magic_prun(self, parameter_s ='',user_mode=1,
output = stdout_trap.getvalue()
output = output.rstrip()
page.page(output)
if not opts.has_key('q'):
The has_key method is deprecated - we should use
if 'q' not in opts
instead.
Reply to this email directly or view it on GitHub:
https://github.com/ipython/ipython/pull/1210/files#r315482
Andrew Giessel, PhD
Department of Neurobiology, Harvard Medical School
220 Longwood Ave Boston, MA 02115
ph: 617.432.7971 email: andrew_giessel@hms.harvard.edu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, some of the older code was written like that, and hasn't been updated. We're slowly updating it as we revisit it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, missed your question. Just add another commit after this one, and push it to the same branch (we usually make a feature branch, rather than working on master). The pull request automatically updates when you add commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to make a new PR - any changes to the branch associated with this PR (master) will be reflected here. You can even remove/edit commits and replace them with a force-push (push -f
).
There are a lot of places in this file where |
Can I suggest you just do the new feature on its own, and if you want to do substantial clean-ups, do them as a separate PR? It's fine to do a couple of small cleanups in the same function, but beyond that it's hard to see what's really changed. Also, please test |
these are both excellent suggestions, thanks! best, ag On Wed, Dec 28, 2011 at 13:24, Thomas <
Andrew Giessel, PhD Department of Neurobiology, Harvard Medical School |
with this in mind, should we cancel this pull request? I can submit a new Related, if there is a best practice doc someplace, I'd be happy to read On Thu, Dec 29, 2011 at 20:14, andrew giessel andrew.giessel@gmail.comwrote:
Andrew Giessel, PhD Department of Neurobiology, Harvard Medical School |
You don't need to cancel a Pull Request, you can force push a new set of commits by |
You can always replace the commits in a PR, but in this case I think it's cleaner to cancel it and start the discussion afresh on a new PR. Thanks, Andrew. |
Oh, and our docs on the development workflow: http://ipython.org/ipython-doc/stable/development/gitwash/index.html |
@andrewgiessel, given that this PR doesn't merge anymore because of conflicts with changes in master in the meantime, and given the discussion above, it seems to me that the best solution is to close this one and for you to open a new one with the feedback you received above: use We appreciate your contribution, and once you get a hang of the process you'll see it goes pretty smoothly. Let us know if anything isn't clear and we'll be happy to help you. |
Edited magic.py to add an extra option to magic_prun(). Specifically, added -q to suppress output to the screen via the pager. This eases use of %prun to do profiling of multiple functions inside of another script.