(self, token, state)
return self.completions[state]
Return a possible completion for readline

        This function is called with state starting at zero to get the
        first completion, then one/two/three etc until you return None.  The best
        implementation is to generate the list when state==0, save it,
        and provide members on each increase.

        The default implementation extracts the current full input
        from readline and then calls :meth:`complete_command` or
        :meth:`complete_sql` as appropriate saving the results for
        subsequent calls.
Return a possible completion for readline
Return a possible completion for readline
def complete(self, token, state):
        """Return a possible completion for readline

        This function is called with state starting at zero to get the
        first completion, then one/two/three etc until you return None.  The best
        implementation is to generate the list when state==0, save it,
        and provide members on each increase.

        The default implementation extracts the current full input
        from readline and then calls :meth:`complete_command` or
        :meth:`complete_sql` as appropriate saving the results for
        subsequent calls.
        """
        if state == 0:
            import readline
            # the whole line
            line = readline.get_line_buffer()
            # beginning and end(+1) of the token in line
            beg = readline.get_begidx()
            end = readline.get_endidx()
            # Are we matching a command?
            try:
                if self._completion_first and line.startswith("."):
                    self.completions = self.complete_command(line, token, beg, end)
                else:
                    self.completions = self.complete_sql(line, token, beg, end)
            except:
                # Readline swallows any exceptions we raise.  We
                # shouldn't be raising any so this is to catch that
                import traceback
                traceback.print_exc()
                raise

        if state > len(self.completions):
            return None
        return self.completions[state]
def complete ( self , token , state ) : if state == 0 : import readline # the whole line line = readline . get_line_buffer ( ) # beginning and end(+1) of the token in line beg = readline . get_begidx ( ) end = readline . get_endidx ( ) # Are we matching a command? try : if self . _completion_first and line . startswith ( "." ) : self . completions = self . complete_command ( line , token , beg , end ) else : self . completions = self . complete_sql ( line , token , beg , end ) except : # Readline swallows any exceptions we raise.  We # shouldn't be raising any so this is to catch that import traceback traceback . print_exc ( ) raise if state > len ( self . completions ) : return None return self . completions [ state ]