<commit_before>from . import *

import readline

ps1 = '\n% '
ps2 = '| '
try:
    from blessings import Terminal
    term = Terminal()
    ps1 = term.bold_blue(ps1)
    ps2 = term.bold_blue(ps2)
    def fancy_movement():
        print(term.move_up() + term.clear_eol() + term.move_up())
except ImportError:
    def fancy_movement():
        pass

def getfilefunc(mod, droplast=True):
    return Func(tuple(fixtags(flattenbody(mod, droplast=droplast))))

def runfile(fname):
    invoke(getfilefunc(parseFile(fname)), stdlib())

def readProgram():
    try:
        yield input(ps1)
        while True:
            line = input(ps2)
            if not line:
                fancy_movement()
                return
            yield line
    except EOFError:
        print()
        raise SystemExit

def interactive():
    env = stdlib()
    while True:
        try:
            retval, = invoke(getfilefunc(parseString('\n'.join(readProgram())), droplast=False), env)
            if retval is not None:
                print(arepr(retval))
        except KeyboardInterrupt:
            print()
        except Exception as e:
            print(e)

import sys
if len(sys.argv) > 1:
    runfile(sys.argv[1])
else:
    interactive()
<commit_msg>Remove colors from REPL prompt<commit_after>from . import *

import readline

ps1 = '\n% '
ps2 = '| '
try:
    from blessings import Terminal
    term = Terminal()
    def fancy_movement():
        print(term.move_up() + term.clear_eol() + term.move_up())
except ImportError:
    def fancy_movement():
        pass

def getfilefunc(mod, droplast=True):
    return Func(tuple(fixtags(flattenbody(mod, droplast=droplast))))

def runfile(fname):
    invoke(getfilefunc(parseFile(fname)), stdlib())

def readProgram():
    try:
        yield input(ps1)
        while True:
            line = input(ps2)
            if not line:
                fancy_movement()
                return
            yield line
    except EOFError:
        print()
        raise SystemExit

def interactive():
    env = stdlib()
    while True:
        try:
            retval, = invoke(getfilefunc(parseString('\n'.join(readProgram())), droplast=False), env)
            if retval is not None:
                print(arepr(retval))
        except KeyboardInterrupt:
            print()
        except Exception as e:
            print(e)

import sys
if len(sys.argv) > 1:
    runfile(sys.argv[1])
else:
    interactive()

{'fraction_non_alphanumeric': 0.11170431211498973, 'fraction_numerical': 0.006570841889117043, 'mean_word_length': 2.2010512483574245, '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': '2697183', 'n_tokens_mistral': 766, 'n_tokens_neox': 759, 'n_words': 184}