<commit_before>from flask import Flask
from flask.ext.assets import Bundle, Environment
from flask.ext.cors import CORS
from flask.ext.script import Manager
from flask_s3 import FlaskS3
from webassets.filter import register_filter
from webassets_browserify import Browserify
from cunhajacaiu.s3upload import AmazonS3Upload

# create app
app = Flask('cunhajacaiu')
app.config.from_object('cunhajacaiu.settings')

# set CORS headers
CORS(app, resources={r'/api/*': {'origins': '*'}})

# create assets
register_filter(Browserify)
assets = Environment(app)

css_args = dict(filters=('libsass',),
                output='css/app.min.css',
                depends=('**/*.sass',))
css_bundle = Bundle('sass/app.sass', **css_args)
assets.register('css', css_bundle)

js_args = dict(filters=('browserify', 'uglifyjs'),
               output='js/app.min.js',
               depends=('**/*.js', '**/*.jsx'))
js_bundle = Bundle('jsx/app.js', **js_args)
assets.register('js', js_bundle)

# create manager
manager = Manager(app)

# add amazon s3 via flask-s3
if app.config['FLASKS3_BUCKET_NAME'] and not app.debug:
    FlaskS3(app)
    manager.add_command('collectstatic', AmazonS3Upload(app))

# import & register blueprints<commit_msg>Load AmazonS3Upload only if Amazon S3 is set<commit_after>from flask import Flask
from flask.ext.assets import Bundle, Environment
from flask.ext.cors import CORS
from flask.ext.script import Manager
from flask_s3 import FlaskS3
from webassets.filter import register_filter
from webassets_browserify import Browserify

# create app
app = Flask('cunhajacaiu')
app.config.from_object('cunhajacaiu.settings')

# set CORS headers
CORS(app, resources={r'/api/*': {'origins': '*'}})

# create assets
register_filter(Browserify)
assets = Environment(app)

css_args = dict(filters=('libsass',),
                output='css/app.min.css',
                depends=('**/*.sass',))
css_bundle = Bundle('sass/app.sass', **css_args)
assets.register('css', css_bundle)

js_args = dict(filters=('browserify', 'uglifyjs'),
               output='js/app.min.js',
               depends=('**/*.js', '**/*.jsx'))
js_bundle = Bundle('jsx/app.js', **js_args)
assets.register('js', js_bundle)

# create manager
manager = Manager(app)

# add amazon s3 via flask-s3
if app.config['FLASKS3_BUCKET_NAME'] and not app.debug:
    from cunhajacaiu.s3upload import AmazonS3Upload
    FlaskS3(app)
    manager.add_command('collectstatic', AmazonS3Upload(app))

# import & register blueprints
{'fraction_non_alphanumeric': 0.14026602176541716, 'fraction_numerical': 0.008061265618702136, 'mean_word_length': 4.59009009009009, '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': '6503396', 'n_tokens_mistral': 861, 'n_tokens_neox': 836, 'n_words': 184}