<commit_before>"""
Goal: Init the Flask Singletons 'app' and 'db'
used by ../run.py

@authors:
  <NAME>             <<EMAIL>>
  <NAME>       <<EMAIL>>
  <NAME>       <<EMAIL>>
"""

import time

try:
    from flask import Flask, g
    from flask_sqlalchemy import SQLAlchemy
except ImportError, error:
    import sys
    sys.exit("Missing required package: {}".format(error))


# The WSGI compliant web-application object
app = Flask(__name__)

# The Object-Relationan-Mapping (ORM) object
db = SQLAlchemy(app)



#@app.before_request
#def before_request():
#    """ Set a timer """
#    g.start = time.time()
#

#@app.after_request
#def after_request(response):
#    """
#    @TODO: log how long it took to parse the request
#    """
#    diff = time.time() - g.start
#    app.logger.debug("Exec time: {}".format(str(diff)))
#
#    if response.response and "__EXE_TIME__" in response.response:
#        response.response = response.response.replace(
#            '__EXE_TIME__', str(diff))
#        response.headers["content-length"] = len(response.response)
#
#    return response

#@app.teardown_request
#def end_of_request(exception=None):
#    """ Release resources """
#    if exception is not None:
#        app.logger.debug("end_of_request() exception: {}".format(exception))
#
#    if app.db_session is not None:
#        #app.logger.debug("removing session...")
#        app.db_session.remove()<commit_msg>Remove unused imports/code in main.py before/after request<commit_after>"""
Goal: Init the Flask Singletons 'app' and 'db'
used by ../run.py

@authors:
  <NAME>             <<EMAIL>>
  <NAME>       <<EMAIL>>
  <NAME>       <<EMAIL>>
"""

try:
    from flask import Flask
    from flask_sqlalchemy import SQLAlchemy
except ImportError, error:
    import sys
    sys.exit("Missing required package: {}".format(error))


# The WSGI compliant web-application object
app = Flask(__name__)

# The Object-Relationan-Mapping (ORM) object
db = SQLAlchemy(app)
{'fraction_non_alphanumeric': 0.14249363867684478, 'fraction_numerical': 0.0, 'mean_word_length': 3.3303964757709252, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '7184690', 'n_tokens_mistral': 660, 'n_tokens_neox': 636, 'n_words': 170}