<commit_before>﻿#!/usr/local/bin/python -tt
# -*- coding: utf-8 -*-

import os
import time

import aem
kAE = aem.kae

import appscript
app = appscript.app

import mactypes as mt

import aemreceive
installeventhandler = aemreceive.installeventhandler

import Carbon.CarbonEvt
RunApplicationEventLoop = Carbon.CarbonEvt.RunApplicationEventLoop
QuitApplicationEventLoop = Carbon.CarbonEvt.QuitApplicationEventLoop

import pdb
import pprint
pp = pprint.pprint

kwdbg = True

def waitAndLaunch(params):

    if u'\r' in params:
        path, doc, seconds = params.split(u'\r', 2)
    else:
        path, doc, seconds = params.split(u'\n', 2)

    if kwdbg:
        pp(params)

    try:
        seconds = float( seconds )
    except Exception, err:
        print
        print err
        seconds = 0.0
    if seconds:
        time.sleep( seconds )

    docpath = mt.File( doc )

    if os.path.exists( path ):
        fmp = app( path )
        # fmp.launch()
        fmp.run()
        fmp.activate()
        time.sleep( 3 )
        if os.path.exists( doc ):
            fmp.open( docpath.alias )
    else:
        finder = app("Finder.app")
        finder.open( docpath.alias )

def openapp():
    app("").activate()
    time.sleep(2)<commit_msg>Details.<commit_after>﻿#!/usr/local/bin/python -tt
# -*- coding: utf-8 -*-

import os
import time

import aem
kAE = aem.kae

import appscript
app = appscript.app

import mactypes as mt

import aemreceive
installeventhandler = aemreceive.installeventhandler

import Carbon.CarbonEvt
RunApplicationEventLoop = Carbon.CarbonEvt.RunApplicationEventLoop
QuitApplicationEventLoop = Carbon.CarbonEvt.QuitApplicationEventLoop

import pdb
import pprint
pp = pprint.pprint

kwdbg = True

def waitAndLaunch(params):

    if u'\r' in params:
        path, doc, seconds = params.split(u'\r', 2)
    else:
        path, doc, seconds = params.split(u'\n', 2)

    try:
        seconds = float( seconds )
    except Exception, err:
        print
        print err
        seconds = 0.0

    if kwdbg:
        print "APP:", repr( path )
        print "DOC:", repr( doc )
        print "DELAY:", repr( seconds )

    if seconds:
        time.sleep( seconds )

    docpath = mt.File( doc )

    if os.path.exists( path ):
        fmp = app( path )
        # fmp.launch()
        fmp.run()
        fmp.activate()
        # time.sleep( 3 )
        if os.path.exists( doc ):
            fmp.open( docpath.alias )
    else:
        finder = app("Finder.app")
        finder.open( docpath.alias )

def openapp():
    app("").activate()
    time.sleep(2)
{'fraction_non_alphanumeric': 0.11361867704280156, 'fraction_numerical': 0.005447470817120622, 'mean_word_length': 2.3303108808290154, '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': '2580764', 'n_tokens_mistral': 880, 'n_tokens_neox': 841, 'n_words': 214}