<commit_before># -*- coding: utf8 -*-
"""
Burp-UI is a web-ui for burp backup written in python with Flask and
jQuery/Bootstrap

.. module:: burpui.cli
    :platform: Unix
    :synopsis: Burp-UI CLI module.

.. moduleauthor:: Ziirish <<EMAIL>>
"""
import os
import sys
import click
import subprocess

from .app import create_app

ROOT = os.path.dirname(os.path.realpath(__file__))
DEBUG = os.environ.get('BUI_DEBUG') or os.environ.get('FLASK_DEBUG') or False
if DEBUG and DEBUG.lower() in ['true', 'yes', '1']:
    DEBUG = True

VERBOSE = os.environ.get('BUI_VERBOSE') or 0
if VERBOSE:
    try:
        VERBOSE = int(VERBOSE)
    except ValueError:
        VERBOSE = 0

# UNITTEST is used to skip the burp-2 requirements for modes != server
UNITTEST = os.environ.get('BUI_MODE') not in ['server', 'manage', 'celery', 'legacy']
CLI = os.environ.get('BUI_MODE') not in ['server', 'legacy']

try:
    app = create_app(
        conf=os.environ.get('BUI_CONFIG'),
        verbose=VERBOSE,
        logfile=os.environ.get('BUI_LOGFILE'),
        debug=DEBUG,
        gunicorn=False,
        unittest=UNITTEST,
        cli=CLI
    )
except:
    import traceback
    traceback.print_exc()

try:
    from .app import create_db
    from .ext.sql import db
    from flask_migrate import Migrate

    # This may have been reseted by create_app
    if isinstance(app.database, bool):
        app.config['WITH_SQL'] = app.database
    else:
        app.config['WITH_SQL'] = app.database and \
            app.database.lower() != 'none'

    if app.config['WITH_SQL']:
        create_db(app, True)

        mig_dir = os.getenv('BUI_MIGRATIONS')
        if mig_dir:
            migrate = Migrate(app, db, mig_dir)
        else:
            migrate = Migrate(app, db)<commit_msg>don't catch exception at application creation to avoid starting with an empty context<commit_after># -*- coding: utf8 -*-
"""
Burp-UI is a web-ui for burp backup written in python with Flask and
jQuery/Bootstrap

.. module:: burpui.cli
    :platform: Unix
    :synopsis: Burp-UI CLI module.

.. moduleauthor:: Ziirish <<EMAIL>>
"""
import os
import sys
import click
import subprocess

from .app import create_app

ROOT = os.path.dirname(os.path.realpath(__file__))
DEBUG = os.environ.get('BUI_DEBUG') or os.environ.get('FLASK_DEBUG') or False
if DEBUG and DEBUG.lower() in ['true', 'yes', '1']:
    DEBUG = True

VERBOSE = os.environ.get('BUI_VERBOSE') or 0
if VERBOSE:
    try:
        VERBOSE = int(VERBOSE)
    except ValueError:
        VERBOSE = 0

# UNITTEST is used to skip the burp-2 requirements for modes != server
UNITTEST = os.environ.get('BUI_MODE') not in ['server', 'manage', 'celery', 'legacy']
CLI = os.environ.get('BUI_MODE') not in ['server', 'legacy']

app = create_app(
    conf=os.environ.get('BUI_CONFIG'),
    verbose=VERBOSE,
    logfile=os.environ.get('BUI_LOGFILE'),
    debug=DEBUG,
    gunicorn=False,
    unittest=UNITTEST,
    cli=CLI
)

try:
    from .app import create_db
    from .ext.sql import db
    from flask_migrate import Migrate

    # This may have been reseted by create_app
    if isinstance(app.database, bool):
        app.config['WITH_SQL'] = app.database
    else:
        app.config['WITH_SQL'] = app.database and \
            app.database.lower() != 'none'

    if app.config['WITH_SQL']:
        create_db(app, True)

        mig_dir = os.getenv('BUI_MIGRATIONS')
        if mig_dir:
            migrate = Migrate(app, db, mig_dir)
        else:
            migrate = Migrate(app, db)
{'fraction_non_alphanumeric': 0.12578616352201258, 'fraction_numerical': 0.002858776443682104, 'mean_word_length': 2.944757609921082, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4687078', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1202, 'n_words': 320}