trepan/lib/complete.py
def complete_token_filtered_with_next(aliases, prefix, expanded, commands):
    """Find all starting matches in dictionary *aliases* that start
    with *prefix*, but filter out any matches already in
    *expanded*."""

    complete_ary = list(aliases.keys())
    expanded_ary = list(expanded.keys())
    # result = [cmd for cmd in
    #             complete_ary if cmd.startswith(prefix) and not (
    #                 cmd in aliases and
    #                 0 == len(set(expanded_ary) - set([aliases[cmd]])))]
    result = []
    for cmd in complete_ary:
        if cmd.startswith(prefix):
            if cmd in aliases and (
                    0 == len(set(expanded_ary) - set([aliases[cmd]]))):
                result.append([cmd, aliases[cmd]])
            pass
        pass
    pass
    return sorted(result, key=lambda pair: pair[0])
def complete_token_filtered_with_next(aliases, prefix, expanded, commands):
    """Find all starting matches in dictionary *aliases* that start
    with *prefix*, but filter out any matches already in
    *expanded*."""

    complete_ary = list(aliases.keys())
    expanded_ary = list(expanded.keys())
    # result = [cmd for cmd in
    #             complete_ary if cmd.startswith(prefix) and not (
    #                 cmd in aliases and
    #                 0 == len(set(expanded_ary) - set([aliases[cmd]])))]
    result = []
    for cmd in complete_ary:
        if cmd.startswith(prefix):
            if cmd in aliases and (
                    0 == len(set(expanded_ary) - set([aliases[cmd]]))):
                result.append([cmd, aliases[cmd]])
            pass
        pass
    pass
    return sorted(result, key=lambda pair: pair[0])
Find all starting matches in dictionary *aliases* that start
    with *prefix*, but filter out any matches already in
    *expanded*.