<commit_before>import fileinput
import os
import sys
import time
from sys import version_info
import PIL
from PIL import Image


def aiToPNG(root, file):
    filename = os.path.join(root, file)
    fileext = os.path.splitext(file)[1]
    fileN = os.path.splitext(file)[0]
    
    
    didRename = False
    
    if len(fileN.split(" ")) > 1:
        fileN = convertToString(fileN.split(" "), "_")
        os.rename(os.path.join(root,file), os.path.join(root,fileN+fileext))
        didRename = True
    
    #print(filename, fileN, fileext)
    
    os.system("gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -sOutputFile="+os.path.join(root, fileN+".png")+" "+os.path.join(root, fileN+fileext)+ "> log.txt")

    if didRename == True: # if did rename, undo the actions
        fileN = convertToString(fileN.split("_"), " ")
        os.rename(os.path.join(root,file), os.path.join(root,fileN+fileext))
<commit_msg>Installs Ghostscript using brew automatically<commit_after>import fileinput
import os
import sys
import time
from sys import version_info
import PIL
from PIL import Image


def checkGhostScript():
    if os.system("which gs > /dev/null") != 0:
        print("Brewing Ghostscript...")
        os.system("brew install ghostscript > log.txt")


def aiToPNG(root, file):
    checkGhostScript()
    filename = os.path.join(root, file)
    fileext = os.path.splitext(file)[1]
    fileN = os.path.splitext(file)[0]
    
    
    didRename = False
    
    if len(fileN.split(" ")) > 1:
        fileN = convertToString(fileN.split(" "), "_")
        os.rename(os.path.join(root,file), os.path.join(root,fileN+fileext))
        didRename = True
    
    #print(filename, fileN, fileext)
    
    os.system("gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -sOutputFile="+os.path.join(root, fileN+".png")+" "+os.path.join(root, fileN+fileext)+ "> log.txt")

    if didRename == True: # if did rename, undo the actions
        fileN = convertToString(fileN.split("_"), " ")
        os.rename(os.path.join(root,file), os.path.join(root,fileN+fileext))
    print("Converted TO PNG")
{'fraction_non_alphanumeric': 0.14829080404429465, 'fraction_numerical': 0.006259027443428021, 'mean_word_length': 3.2757201646090537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '42102', 'n_tokens_mistral': 746, 'n_tokens_neox': 732, 'n_words': 151}