<commit_before>#!/usr/bin/env python

from update_history import *
import sys
import os

if __name__ == "__main__":
    if len(sys.argv) != 2 or sys.argv[1].startswith("/"):
        sys.exit()
    history = update_history().items()
    search_phrase = sys.argv[1]
    num_dirs = search_phrase.count("/") + 1
    to_match = {"/".join(x.split("/")[-1*num_dirs:]):v for x,v in history if len(x.split("/")) > num_dirs}
    matching_history = [x for x in to_match.iteritems() if x[0].startswith(sys.argv[1])]
    names = [x[0] for x in sorted(matching_history, key=lambda x : x[1])]
    seen = set()
    for n in names:
        if n not in seen:
            print n + "/",
            seen.add(n)<commit_msg>comment completions file (still quite dense)<commit_after>#!/usr/bin/env python

from update_history import *
import sys
import os

if __name__ == "__main__":
    if len(sys.argv) != 2 or sys.argv[1].startswith("/"):
        sys.exit()
    history = update_history().items()
    search_phrase = sys.argv[1]
    # We need to check from the start of the first directory listed by the user, so count the number of dirs
    num_dirs = search_phrase.count("/") + 1
    # Now split off every known path at that many directories (but keep the key/value pairs together)
    to_match = {"/".join(x.split("/")[-1*num_dirs:]):v for x,v in history if len(x.split("/")) > num_dirs}
    # Now we can finally check if the directories we found start with the input argument directories
    matching_history = [x for x in to_match.iteritems() if x[0].startswith(sys.argv[1])]
    names = [x[0] for x in sorted(matching_history, key=lambda x : x[1])]
    seen = set()
    for n in names:
        if n not in seen:
            print n + "/",
            seen.add(n)
{'fraction_non_alphanumeric': 0.1423670668953688, 'fraction_numerical': 0.010291595197255575, 'mean_word_length': 3.004576659038902, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1840641', 'n_tokens_mistral': 595, 'n_tokens_neox': 582, 'n_words': 187}