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))
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))
def test_get_valid_history_without_current(self, script, result): command = Command(script=script) assert get_valid_history_without_current(command) == result
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]
def test_get_valid_history_without_current(self, script): command = Command(script, '') assert script not in get_valid_history_without_current(command)
def match(command): return len( get_close_matches(command.script, get_valid_history_without_current(command)))
def get_new_command(command): return get_closest(command.script, get_valid_history_without_current(command))
def match(command): return len(get_close_matches(command.script, get_valid_history_without_current(command)))