From 6b104d4483391839d74863be347fcd938c895b78 2011-03-13 12:51:50 From: Thomas Kluyver Date: 2011-03-13 12:51:50 Subject: [PATCH] Remove duplicate raw_input in TerminalInteractiveShell --- diff --git a/IPython/frontend/terminal/interactiveshell.py b/IPython/frontend/terminal/interactiveshell.py index 1b16bbe..db61a24 100644 --- a/IPython/frontend/terminal/interactiveshell.py +++ b/IPython/frontend/terminal/interactiveshell.py @@ -282,67 +282,6 @@ class TerminalInteractiveShell(InteractiveShell): # Turn off the exit flag, so the mainloop can be restarted if desired self.exit_now = False - def raw_input(self, prompt='', continue_prompt=False): - """Write a prompt and read a line. - - The returned line does not include the trailing newline. - When the user enters the EOF key sequence, EOFError is raised. - - Optional inputs: - - - prompt(''): a string to be printed to prompt the user. - - - continue_prompt(False): whether this line is the first one or a - continuation in a sequence of inputs. - """ - # Code run by the user may have modified the readline completer state. - # We must ensure that our completer is back in place. - - if self.has_readline: - self.set_readline_completer() - - try: - line = raw_input_original(prompt).decode(self.stdin_encoding) - except ValueError: - warn("\n********\nYou or a %run:ed script called sys.stdin.close()" - " or sys.stdout.close()!\nExiting IPython!") - self.ask_exit() - return "" - - # Try to be reasonably smart about not re-indenting pasted input more - # than necessary. We do this by trimming out the auto-indent initial - # spaces, if the user's actual input started itself with whitespace. - if self.autoindent: - if num_ini_spaces(line) > self.indent_current_nsp: - line = line[self.indent_current_nsp:] - self.indent_current_nsp = 0 - - # store the unfiltered input before the user has any chance to modify - # it. - if line.strip(): - if continue_prompt: - if self.has_readline and self.readline_use: - histlen = self.readline.get_current_history_length() - if histlen > 1: - newhist = self.history_manager.input_hist_raw[-1].rstrip() - self.readline.remove_history_item(histlen-1) - self.readline.replace_history_item(histlen-2, - newhist.encode(self.stdin_encoding)) - else: - self.history_manager.input_hist_raw.append('%s\n' % line) - elif not continue_prompt: - self.history_manager.input_hist_raw.append('\n') - try: - lineout = self.prefilter_manager.prefilter_lines(line,continue_prompt) - except: - # blanket except, in case a user-defined prefilter crashes, so it - # can't take all of ipython with it. - self.showtraceback() - return '' - else: - return lineout - - def raw_input(self, prompt=''): """Write a prompt and read a line.