

def _get_completions(self, inputstring, split_completed_lines=True):
    '\n        Get results of tab completion in cqlsh. Returns a bare string if a\n        string completes immediately. Otherwise, returns a set of all\n        whitespace-separated tokens in the offered completions by default, or a\n        list of the lines in the offered completions if split_completed_lines is\n        False.\n        '
    self.cqlsh.send(inputstring)
    self.cqlsh.send(TAB)
    immediate = self.cqlsh.read_up_to_timeout(COMPLETION_RESPONSE_TIME)
    immediate = immediate.replace(' \x08', '')
    self.assertEqual(immediate[:len(inputstring)], inputstring)
    immediate = immediate[len(inputstring):]
    immediate = immediate.replace(BEL, '')
    if immediate:
        return immediate
    self.cqlsh.send(TAB)
    choice_output = self.cqlsh.read_up_to_timeout(COMPLETION_RESPONSE_TIME)
    if (choice_output == BEL):
        choice_output = ''
    self.cqlsh.send(CTRL_C)
    self.cqlsh.read_to_next_prompt()
    choice_lines = choice_output.splitlines()
    if choice_lines:
        prompt_regex = (self.cqlsh.prompt.lstrip() + re.escape(inputstring))
        msg = 'Double-tab completion does not print prompt for input "{}"'.format(inputstring)
        self.assertRegexpMatches(choice_lines[(- 1)], prompt_regex, msg=msg)
    choice_lines = [line.strip() for line in choice_lines[:(- 1)]]
    choice_lines = [line for line in choice_lines if line]
    if split_completed_lines:
        completed_lines = map(set, (completion_separation_re.split(line.strip()) for line in choice_lines))
        if (not completed_lines):
            return set()
        completed_tokens = set.union(*completed_lines)
        return (completed_tokens - {''})
    else:
        return split_completed_lines
    assert False

dataset/ETHPy150Open francelabs/datafari/cassandra/pylib/cqlshlib/test/test_cqlsh_completion.py CqlshCompletionCase._get_completions/VarMisuse@320/575 `choice_lines`->`split_completed_lines`