示例#1
0
def _get_all_absolute_paths_from_history(command):
    counter = Counter()

    for line in get_valid_history_without_current(command):
        splitted = shell.split_command(line)

        for param in splitted[1:]:
            if param.startswith("/") or param.startswith("~"):
                if param.endswith("/"):
                    param = param[:-1]

                counter[param] += 1

    return (path for path, _ in counter.most_common(None))
示例#2
0
def _get_all_absolute_paths_from_history(command):
    counter = Counter()

    for line in get_valid_history_without_current(command):
        splitted = shell.split_command(line)

        for param in splitted[1:]:
            if param.startswith('/') or param.startswith('~'):
                if param.endswith('/'):
                    param = param[:-1]

                counter[param] += 1

    return (path for path, _ in counter.most_common(None))
示例#3
0
 def test_get_valid_history_without_current(self, script, result):
     command = Command(script=script)
     assert get_valid_history_without_current(command) == result
示例#4
0
 def test_get_valid_history_without_current(self, script, result):
     command = Command(script, "")
     assert get_valid_history_without_current(command) == result
def _get_used_executables(command):
    for script in get_valid_history_without_current(command):
        yield script.split(' ')[0]
示例#6
0
def _get_used_executables(command):
    for script in get_valid_history_without_current(command):
        yield script.split(' ')[0]
示例#7
0
 def test_get_valid_history_without_current(self, script):
     command = Command(script, '')
     assert script not in get_valid_history_without_current(command)
示例#8
0
def match(command):
    return len(
        get_close_matches(command.script,
                          get_valid_history_without_current(command)))
示例#9
0
def get_new_command(command):
    return get_closest(command.script,
                       get_valid_history_without_current(command))
示例#10
0
def get_new_command(command):
    return get_closest(command.script,
                       get_valid_history_without_current(command))
示例#11
0
def match(command):
    return len(get_close_matches(command.script,
                                 get_valid_history_without_current(command)))