<commit_before>#!/usr/bin/env python

import json
import logging
import os

try:
    import queue
except ImportError:
    import Queue as queue
try:
    import socketserver
except ImportError:
    import SocketServer as socketserver

from apscheduler.schedulers.background import BackgroundScheduler
from datetime import datetime, timedelta
from flask import Flask, render_template, Response, request, abort
from flask_assets import Environment, Bundle
from flask.templating import TemplateNotFound
from jobs import load_jobs
from random import randint


app = Flask(__name__)
app.config.from_envvar('JARVIS_SETTINGS')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
sched = BackgroundScheduler(logger=app.logger)
queues = {}
last_events = {}


@app.before_first_request
def _setup_logging():
    if not app.debug:
        formatter = logging.Formatter(
            '%(asctime)s %(levelname)s - %(message)s'
        )
        handler = logging.StreamHandler()
        handler.setFormatter(formatter)
        app.logger.addHandler(handler)
    app.logger.setLevel(logging.INFO)


@app.before_first_request
def _configure_bundles():
    js = ['main.js']
    css = ['main.css']
    widgets_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                                'static', 'widgets'))

    for widget in os.listdir(widgets_path):
        widget_path = os.path.join('widgets', widget)
        for asset_file in os.listdir(os.path.join(widgets_path, widget)):
            asset_path = os.path.join(widget_path, asset_file)
            if asset_file.endswith('.js'):
                js.append(asset_path)
            elif asset_file.endswith('.css'):
                css.append(asset_path)

    assets = Environment(app)
    if app.debug:
        assets.register('js_all', Bundle(*js, output='gen/app.js'))<commit_msg>Remove duplicate log handler<commit_after>#!/usr/bin/env python

import json
import logging
import os

try:
    import queue
except ImportError:
    import Queue as queue
try:
    import socketserver
except ImportError:
    import SocketServer as socketserver

from apscheduler.schedulers.background import BackgroundScheduler
from datetime import datetime, timedelta
from flask import Flask, render_template, Response, request, abort
from flask_assets import Environment, Bundle
from flask.templating import TemplateNotFound
from jobs import load_jobs
from random import randint


app = Flask(__name__)
app.logger.setLevel(logging.INFO)
app.config.from_envvar('JARVIS_SETTINGS')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
sched = BackgroundScheduler(logger=app.logger)
queues = {}
last_events = {}


@app.before_first_request
def _configure_bundles():
    js = ['main.js']
    css = ['main.css']
    widgets_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                                'static', 'widgets'))

    for widget in os.listdir(widgets_path):
        widget_path = os.path.join('widgets', widget)
        for asset_file in os.listdir(os.path.join(widgets_path, widget)):
            asset_path = os.path.join(widget_path, asset_file)
            if asset_file.endswith('.js'):
                js.append(asset_path)
            elif asset_file.endswith('.css'):
                css.append(asset_path)

    assets = Environment(app)
    if app.debug:
        assets.register('js_all', Bundle(*js, output='gen/app.js'))
{'fraction_non_alphanumeric': 0.09956584659913169, 'fraction_numerical': 0.0, 'mean_word_length': 3.293167701863354, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2672610', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1007, 'n_words': 239}