Skip to content

Commit

Permalink
Merge pull request ipython#4 from ivanov/reset-stdinless
Browse files Browse the repository at this point in the history
Relevant docstring changes.
  • Loading branch information
takluyver committed Jan 19, 2012
2 parents a42431b + baf586a commit dd1c5fb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 5 additions & 4 deletions IPython/core/history.py
Expand Up @@ -762,8 +762,10 @@ def magic_history(self, parameter_s = ''):
the default is the last 10 lines.
-f FILENAME: instead of printing the output to the screen, redirect it to
the given file. The file is always overwritten, though IPython asks for
confirmation first if it already exists.
the given file. The file is always overwritten, though *when it can*,
IPython asks for confirmation first. In particular, running the command
"history -f FILENAME" from the IPython Notebook interface will replace
FILENAME even if it already exists *without* confirmation.
Examples
--------
Expand Down Expand Up @@ -801,12 +803,11 @@ def _format_lineno(session, line):
try:
ans = io.ask_yes_no("File %r exists. Overwrite?" % outfname)
except StdinNotImplementedError:
print("Overwriting file.")
ans = True
if not ans:
print('Aborting.')
return

print("Overwriting file.")
outfile = open(outfname,'w')
close_at_end = True

Expand Down
12 changes: 12 additions & 0 deletions IPython/core/magic.py
Expand Up @@ -984,6 +984,12 @@ def magic_reset(self, parameter_s=''):
In [1]: 'a' in _ip.user_ns
Out[1]: False
Notes
-----
Calling this magic from clients that do not implement standard input,
such as the ipython notebook interface, will reset the namespace
without confirmation.
"""
opts, args = self.parse_options(parameter_s,'sf')
if 'f' in opts:
Expand Down Expand Up @@ -1056,6 +1062,12 @@ def magic_reset_selective(self, parameter_s=''):
In [11]: who_ls
Out[11]: ['a']
Notes
-----
Calling this magic from clients that do not implement standard input,
such as the ipython notebook interface, will reset the namespace
without confirmation.
"""

opts, regex = self.parse_options(parameter_s,'f')
Expand Down

0 comments on commit dd1c5fb

Please sign in to comment.