<commit_before>from pest import Pest
import os, sys

def exclude_dir(name):
    return name.startswith('.') 

def exclude_file(name):
    return not name.endswith('.py')

def run(module=None): 
    cmd = './manage.py test'
    if module:
        cmd += ' ' + module
    def callback(changes):
        print changes
        os.system(cmd)
    return callback

def main():
    if len(sys.argv) == 1:
        cb = run(sys.argv[1])
    else:
        cb = run()
    Pest(exclude_file=exclude_file, exclude_dir=exclude_dir,callback=cb).start()
    

if __name__ == '__main__':
    main()<commit_msg>hacked in Growl support, sloppy<commit_after>from pest import Pest
import os, sys

    
def exclude_dir(name):
    return name.startswith('.') 

def exclude_file(name):
    return not name.endswith('.py')

def notify(growl, results):
    if growl:
        if results == 0:
            growl.notify(noteType='pass', title="Tests Pass", description="All tests passed!")
        else:
            growl.notify(noteType='fail', title="Tests Failed", description="FAIL!!!")

def run(module, growl): 
    cmd = './manage.py test'
    if module:
        cmd += ' ' + module
    def callback(changes):
        notify(growl, os.system(cmd))
    return callback

def main():
    try:
        from Growl import GrowlNotifier
        gn = GrowlNotifier(applicationName='djpest', notifications=['pass', 'fail'])
        gn.register()
    except:
        gn = None
    
    app = None
    if len(sys.argv) == 1:
        app = sys.argv[1]

    cb = run(app, gn)
    Pest(exclude_file=exclude_file, exclude_dir=exclude_dir,callback=cb).start()
    

if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.13521634615384615, 'fraction_numerical': 0.0030048076923076925, 'mean_word_length': 2.716517857142857, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3886711', 'n_tokens_mistral': 564, 'n_tokens_neox': 537, 'n_words': 133}