<commit_before>import os
import os.path as osp
import re
import subprocess


def count_directories(base):
    return len([osp.isdir(osp.join(base, dir_)) for dir_ in os.listdir(base)])


def interactive(result_base):
    print('============= Set Result Base ==============')
    print('0:   set result_base as current directory')

    child_dirs = []
    for dir_ in os.listdir(result_base):
        child_dir = osp.join(result_base, dir_)
        if osp.isdir(child_dir):
            try:
                devnull = open(os.devnull, 'w')
                cmd = 'git log -n 1 --pretty=format:%s_____%ai {}'.format(dir_)
                commit_info = subprocess.check_output([cmd], shell=True, stderr=devnull)
                commit_info = re.sub('[^a-zA-Z0-9, \s, _, \-, :]', '', commit_info)
            except:
                commit_info = None
            print('{}:  {}  n_data={} {}'.format(
                len(child_dirs) + 1,
                dir_,
                count_directories(child_dir),
                commit_info))
            child_dirs.append(dir_)

    var = raw_input("Please enter something: ")
    if int(var) == 0:
        return result_base
    elif 1 <= int(var) <= len(child_dirs):
        return child_dirs[int(var) - 1]
    else:
        raise ValueError('invalid input')


if __name__ == '__main__':
    print interactive('result')<commit_msg>fix interactive<commit_after>import os
import os.path as osp
import re
import subprocess


def count_directories(base):
    return len([osp.isdir(osp.join(base, dir_)) for dir_ in os.listdir(base)])


def interactive(result_base):
    print('============= Set Result Base ==============')
    print('0:   set result_base as current directory')

    child_dirs = []
    for dir_ in os.listdir(result_base):
        child_dir = osp.join(result_base, dir_)
        if osp.isdir(child_dir):
            try:
                devnull = open(os.devnull, 'w')
                cmd = 'git log -n 1 --pretty=format:%s_____%ai {}'.format(dir_)
                commit_info = subprocess.check_output([cmd], shell=True, stderr=devnull)
                commit_info = re.sub('[^a-zA-Z0-9, \s, _, \-, :]', '', commit_info)
            except:
                commit_info = None
            print('{}:  {}  n_data={} {}'.format(
                len(child_dirs) + 1,
                dir_,
                count_directories(child_dir),
                commit_info))
            child_dirs.append(dir_)

    var = raw_input("Please enter something: ")
    if int(var) == 0:
        return result_base
    elif 1 <= int(var) <= len(child_dirs):
        return osp.join(result_base, child_dirs[int(var) - 1])
    else:
        raise ValueError('invalid input')


if __name__ == '__main__':
    print interactive('result')
{'fraction_non_alphanumeric': 0.14734561213434452, 'fraction_numerical': 0.00577825929938606, 'mean_word_length': 2.243559718969555, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '1766163', 'n_tokens_mistral': 905, 'n_tokens_neox': 858, 'n_words': 195}