<commit_before>import os

import api
import lrn

l = api.l

from subprocess import call

def check_progress(cmd):
    task = api.get_task()
    test = task['test']
    test_dir = api.get_tests_dir()

    command = "python {}/{}.py {}".format(test_dir, test, cmd)
    status = call(command.split())
    return status

def repl():
    try:
        # os.environ['OLD_PS1'] = os.environ['PS1']
        # os.environ['PS1'] = 'lrn: ' + os.environ['PS1']
        while True:
            l('lrn ', 'cyan', False)
            l('> ', 'blue', False)
            cmd = raw_input('')
            if 'cd ' in cmd:
                folder = cmd[3:]
                os.chdir(folder)
            else:
                os.system(cmd)
            outcome = check_progress(cmd)
            if outcome == 0:
                lrn.next_task()


    except EOFError:
        print('Exiting lrn...')
        exit(0)
        # os.environ['PS1'] = os.environ['OLD_PS1']



if __name__ == '__main__':
    repl()
<commit_msg>'cleanup'<commit_after>import os

import api
import lrn

l = api.l

from subprocess import call

def check_progress(cmd):
    task = api.get_task()
    test = task['test']
    test_dir = api.get_tests_dir()

    command = "python {}/{}.py {}".format(test_dir, test, cmd)
    status = call(command.split())
    return status

def repl():
    try:
        while True:
            l('lrn ', 'cyan', False)
            l('> ', 'blue', False)
            cmd = raw_input('')
            if 'cd ' in cmd:
                folder = cmd[3:]
                os.chdir(folder)
            else:
                os.system(cmd)
            outcome = check_progress(cmd)
            if outcome == 0:
                lrn.next_task()

    except (EOFError, KeyboardInterrupt):
        print('Exiting lrn. Enter `lrn resume` to resume.')
        exit(0)



if __name__ == '__main__':
    repl()

{'fraction_non_alphanumeric': 0.1420940170940171, 'fraction_numerical': 0.00641025641025641, 'mean_word_length': 1.7707100591715976, 'pattern_counts': {'":': 0, '<': 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': '444847', 'n_tokens_mistral': 621, 'n_tokens_neox': 611, 'n_words': 147}