Exemple #1
0
 def preloop(self):
     ''' Keep persistent command history. '''
     if not self.already_prelooped:
         self.already_prelooped = True
         open('.psiturk_history', 'a').close()  # create file if it doesn't exist
         readline.read_history_file('.psiturk_history')
         for i in range(readline.get_current_history_length()):
             if readline.get_history_item(i) is not None:
                 self.history.append(readline.get_history_item(i))
Exemple #2
0
 def preloop(self):
     ''' Keep persistent command history. '''
     if not self.already_prelooped:
         self.already_prelooped = True
         open('.psiturk_history', 'a').close()  # create file if it doesn't exist
         readline.read_history_file('.psiturk_history')
         for i in range(readline.get_current_history_length()):
             if readline.get_history_item(i) is not None:
                 self.history.append(readline.get_history_item(i))
Exemple #3
0
def get_history_items():
    num_items = readline.get_current_history_length() + 1
    return [readline.get_history_item(i) for i in range(1, num_items)]
def get_history_items():
    num_items = readline.get_current_history_length() + 1
    return [
        readline.get_history_item(i)
        for i in range(1, num_items)
    ]