parameters: (self, prompt='')
return_statement: return self.l_buffer.get_line_text() + '\n'
docstring: Try to act like GNU readline.
docstring_summary: Try to act like GNU readline.
docstring_tokens: Try to act like GNU readline .
function: def readline(self, prompt=''):
          '''Try to act like GNU readline.'''
          # handle startup_hook
          if self.first_prompt:
              self.first_prompt = False
              if self.startup_hook:
                  try:
                      self.startup_hook()
                  except:
                      print('startup hook failed')
                      traceback.print_exc()
  
          c = self.console
          self.l_buffer.reset_line()
          self.prompt = prompt
          self._print_prompt()
  
          if self.pre_input_hook:
              try:
                  self.pre_input_hook()
              except:
                  print('pre_input_hook failed')
                  traceback.print_exc()
                  self.pre_input_hook = None
  
          log("in readline: %s" % self.paste_line_buffer)
          if len(self.paste_line_buffer) > 0:
              self.l_buffer = lineobj.ReadlineTextBuffer(self.paste_line_buffer[
                  0])
              self._update_line()
              self.paste_line_buffer = self.paste_line_buffer[1:]
              c.write('\r\n')
          else:
              self._readline_from_keyboard()
              c.write('\r\n')
  
          self.add_history(self.l_buffer.copy())
  
          log('returning(%s)' % self.l_buffer.get_line_text())
          return self.l_buffer.get_line_text() + '\n'
function_tokens: def readline ( self , prompt = '' ) : # handle startup_hook if self . first_prompt : self . first_prompt = False if self . startup_hook : try : self . startup_hook ( ) except : print ( 'startup hook failed' ) traceback . print_exc ( ) c = self . console self . l_buffer . reset_line ( ) self . prompt = prompt self . _print_prompt ( ) if self . pre_input_hook : try : self . pre_input_hook ( ) except : print ( 'pre_input_hook failed' ) traceback . print_exc ( ) self . pre_input_hook = None log ( "in readline: %s" % self . paste_line_buffer ) if len ( self . paste_line_buffer ) > 0 : self . l_buffer = lineobj . ReadlineTextBuffer ( self . paste_line_buffer [ 0 ] ) self . _update_line ( ) self . paste_line_buffer = self . paste_line_buffer [ 1 : ] c . write ( '\r\n' ) else : self . _readline_from_keyboard ( ) c . write ( '\r\n' ) self . add_history ( self . l_buffer . copy ( ) ) log ( 'returning(%s)' % self . l_buffer . get_line_text ( ) ) return self . l_buffer . get_line_text ( ) + '\n'