<commit_before>from urllib2 import urlopen
import zipfile as zf
from mojo.extensions import *
from vanilla import dialogs
import os

temp = '/tmp/'

def unzip(zipFilePath, destDir):
    zipped_dir = zf.ZipFile(zipFilePath)
    for name in zipped_dir.namelist():
        (dirName, fileName) = os.path.split(name)
        if fileName == '':
            # so this file is a directory
            newDir = destDir + '/' + dirName
            if not os.path.exists(newDir):
                os.mkdir(newDir)
        else:
            # so this is a file with an extension
            fd = open(destDir + '/' + name, 'wb')
            fd.write(zipped_dir.read(name))
            fd.close()
    zipped_dir.close()

def download(url, destDir):
    zip_path = temp + destDir + '.zip'
    response = urlopen(url)
    CHUNK = 16 * 1024
    with open(zip_path, 'wb') as f:
        while True:
            chunk = response.read(CHUNK)
            if not chunk:
                break
            f.write(chunk)

    unzip(zip_path, temp) # Unzip it into temp

def install_extension(url, destDir, extName):
    """Download extension, unzip it, and install in RoboFont."""

    download(url,destDir)
    extension_path = temp + destDir + '/' + extName
    extension = ExtensionBundle(extension_path)
    extension.install()

########## End of functions, now the scripting ##########

install_extension('https://github.com/jackjennings/Mechanic/archive/master.zip', 'Mechanic-master', 'Mechanic.roboFontExt')
install_extension('https://github.com/ghostlines/ghostlines-robofont/archive/v1.zip', 'ghostlines-robofont-master', 'Ghostlines.roboFontExt')

try:
    import mechanic
except:
    dialogs.message("Error installing Mechanic.")

try:
    import ghostlines
except:
    dialogs.message("Error installing Ghostlines.")

from ghostlines.windows.account import AccountWindow

AccountWindow().open()<commit_msg>Fix module name in install.py<commit_after>from urllib2 import urlopen
import zipfile as zf
from mojo.extensions import *
from vanilla import dialogs
import os

temp = '/tmp/'

def unzip(zipFilePath, destDir):
    zipped_dir = zf.ZipFile(zipFilePath)
    for name in zipped_dir.namelist():
        (dirName, fileName) = os.path.split(name)
        if fileName == '':
            # so this file is a directory
            newDir = destDir + '/' + dirName
            if not os.path.exists(newDir):
                os.mkdir(newDir)
        else:
            # so this is a file with an extension
            fd = open(destDir + '/' + name, 'wb')
            fd.write(zipped_dir.read(name))
            fd.close()
    zipped_dir.close()

def download(url, destDir):
    zip_path = temp + destDir + '.zip'
    response = urlopen(url)
    CHUNK = 16 * 1024
    with open(zip_path, 'wb') as f:
        while True:
            chunk = response.read(CHUNK)
            if not chunk:
                break
            f.write(chunk)

    unzip(zip_path, temp) # Unzip it into temp

def install_extension(url, destDir, extName):
    """Download extension, unzip it, and install in RoboFont."""

    download(url,destDir)
    extension_path = temp + destDir + '/' + extName
    extension = ExtensionBundle(extension_path)
    extension.install()

########## End of functions, now the scripting ##########

install_extension('https://github.com/jackjennings/Mechanic/archive/master.zip', 'Mechanic-master', 'Mechanic.roboFontExt')
install_extension('https://github.com/ghostlines/ghostlines-robofont/archive/v1.zip', 'ghostlines-robofont-master', 'Ghostlines.roboFontExt')

try:
    import mechanic
except:
    dialogs.message("Error installing Mechanic.")

try:
    import ghostlines
except:
    dialogs.message("Error installing Ghostlines.")

from ghostlines.windows.account_window import AccountWindow

AccountWindow().open()
{'fraction_non_alphanumeric': 0.11939123589609027, 'fraction_numerical': 0.004198373130411965, 'mean_word_length': 2.8582995951417005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2422309', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1164, 'n_words': 293}