Skip to content

Implement boundary option for load magic (#1093) #4295

Merged
minrk merged 3 commits into
ipython:masterfrom
mgaitan:1093_boundary_load_magic
Sep 30, 2013
Merged

Implement boundary option for load magic (#1093) #4295
minrk merged 3 commits into
ipython:masterfrom
mgaitan:1093_boundary_load_magic

Conversation

@mgaitan
Copy link
Copy Markdown
Contributor

@mgaitan mgaitan commented Sep 28, 2013

This is an implementation of #1093. Usage example is in this notebook

http://nbviewer.ipython.org/6746907

Comment thread IPython/core/magics/code.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the comment here match the regex below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right. a careless copy&paste. fixing.

@Carreau
Copy link
Copy Markdown
Member

Carreau commented Sep 29, 2013

I'm wondering wether there is some code that could be share/factored from
extract_hist_ranges in IPython/core/history.py, the behavior might be slighty different or to painfull to share code.

Just wondering.

@mgaitan
Copy link
Copy Markdown
Contributor Author

mgaitan commented Sep 29, 2013

Thanks @Carreau . as I thought the same thing I decided implement an independent extract_code_ranges and don't touch history.py .

@damianavila
Copy link
Copy Markdown
Member

Nice addition... and looks good.

@Carreau
Copy link
Copy Markdown
Member

Carreau commented Sep 29, 2013

+1 too.

Comment thread IPython/core/tests/test_magic.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you have an editor configured to strip whitespace in blocks you are not actually editing. Can you rebase without these unhelpful changes?

@minrk
Copy link
Copy Markdown
Member

minrk commented Sep 29, 2013

Looks good to me, after rebasing without the large whitespace changes. This is fairly straightforward with:

alias git-rebase-nows='git rebase -i --exec="git format-patch -w HEAD^1 --stdout | sh -c \"git reset HEAD^1 --hard; git am -\""'
git-rebase-nows origin/master

@mgaitan
Copy link
Copy Markdown
Contributor Author

mgaitan commented Sep 30, 2013

@minrk the alias trick didn't work for me. (I got error: unknown optionexec=git format-patch -w HEAD^1 --stdout | sh -c "git reset HEAD^1 --hard; git am -"'`). I've forced the branch applying my last commit against master HEAD ignore whitespaces

$ git diff HEAD 4ef59c262 --ignore-space-at-eol > patch
$ git apply --ignore-whitespace patch

hope this would be ok. I'll config the editor/git to avoid this unhelpful changes.

@damianavila
Copy link
Copy Markdown
Member

Great! Much cleaner now...

@mgaitan
Copy link
Copy Markdown
Contributor Author

mgaitan commented Sep 30, 2013

Please, could you review mgaitan/ipython@d4d4726 . I feel more comfortable with python than with english :)

@minrk
Copy link
Copy Markdown
Member

minrk commented Sep 30, 2013

Sorry if my example didn't work for you, may be a git version issue, or maybe I pasted it wrong. Anyway, thanks for your patience, merging now.

minrk added a commit that referenced this pull request Sep 30, 2013
Implement boundary option for load magic

`%load -r 1-10` now does what one should expect.

closes #1093
@minrk minrk merged commit 9bfd855 into ipython:master Sep 30, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Implement boundary option for load magic

`%load -r 1-10` now does what one should expect.

closes ipython#1093
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.

4 participants