<commit_before>from mediacrush.app import app
from mediacrush.config import _cfg, _cfgi
from mediacrush.files import extension

import os
import scss
import coffeescript
from slimit import minify
from shutil import rmtree, copyfile

app.static_folder = os.path.join(os.getcwd(), "static")
scss.config.LOAD_PATHS = [
    './styles/'
]

def prepare():
    if os.path.exists(app.static_folder):
        rmtree(app.static_folder)
    os.makedirs(app.static_folder)
    compiler = scss.Scss(scss_opts = {
        'style': 'compressed'
    })

    # Compile styles (scss)
    d = os.walk('styles')
    for f in list(d)[0][2]:
        if extension(f) == "scss":
            with open(os.path.join('styles', f)) as r:
                output = compiler.compile(r.read())

            parts = f.rsplit('.')
            css = '.'.join(parts[:-1]) + ".css"

            with open(os.path.join(app.static_folder, css), "w") as w:
                w.write(output)
                w.flush()
    
    # Compile scripts (coffeescript)
    d = os.walk('scripts')
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('scripts', f)
        if extension(f) == "js":
            copyfile(inputpath, outputpath)
        elif extension(f) == "manifest":
            with open(inputpath) as r:
                manifest = r.read().split('\n')
            javascript = ''
            for script in manifest:
                if script == '':<commit_msg>Allow whitespace and comments in manifest files<commit_after>from mediacrush.app import app
from mediacrush.config import _cfg, _cfgi
from mediacrush.files import extension

import os
import scss
import coffeescript
from slimit import minify
from shutil import rmtree, copyfile

app.static_folder = os.path.join(os.getcwd(), "static")
scss.config.LOAD_PATHS = [
    './styles/'
]

def prepare():
    if os.path.exists(app.static_folder):
        rmtree(app.static_folder)
    os.makedirs(app.static_folder)
    compiler = scss.Scss(scss_opts = {
        'style': 'compressed'
    })

    # Compile styles (scss)
    d = os.walk('styles')
    for f in list(d)[0][2]:
        if extension(f) == "scss":
            with open(os.path.join('styles', f)) as r:
                output = compiler.compile(r.read())

            parts = f.rsplit('.')
            css = '.'.join(parts[:-1]) + ".css"

            with open(os.path.join(app.static_folder, css), "w") as w:
                w.write(output)
                w.flush()
    
    # Compile scripts (coffeescript)
    d = os.walk('scripts')
    for f in list(d)[0][2]:
        outputpath = os.path.join(app.static_folder, os.path.basename(f))
        inputpath = os.path.join('scripts', f)
        if extension(f) == "js":
            copyfile(inputpath, outputpath)
        elif extension(f) == "manifest":
            with open(inputpath) as r:
                manifest = r.read().split('\n')
            javascript = ''
            for script in manifest:
                script = script.strip(' ')
                if script == '' or script.startswith('#'):
{'fraction_non_alphanumeric': 0.13996789727126807, 'fraction_numerical': 0.0032102728731942215, 'mean_word_length': 2.215686274509804, 'pattern_counts': {'":': 6, '<': 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': '4830348', 'n_tokens_mistral': 1015, 'n_tokens_neox': 997, 'n_words': 232}