<commit_before>from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from .navigation import MyNavigation as Navigation
from .navigation import NavBarItem as Item
from flaskext.markdown import Markdown

# Flask
app = Flask(__name__)
app.config.from_object('config')

# SQLAlchemy
db = SQLAlchemy(app)

# Flask-Markdown
Markdown(app)

# Flask-Navigation
nav = Navigation(app)
# Create main navigation bar and add Home button.
nav.Bar('base', [nav.Item('Home', 'index')])

# Setup modules
# The order of calling setup_module determines the order of the main navigation bar items.
nav_bar = nav['base']
import app.mod_projects as projects_module
import app.mod_streams as streams_module
import app.mod_adminpanel as adminpanel_module
import app.mod_auth as auth_module
import app.mod_todo as todo_module
projects_module.setup_module(app, nav_bar)
streams_module.setup_module(app, nav_bar)
adminpanel_module.setup_module(app, nav_bar)
auth_module.setup_module(app, nav_bar)
todo_module.setup_module(app, nav_bar)

# Setup error handling
import logging

# if not app.debug:
#     # Via email
#     from logging.handlers import SMTPHandler
#     credentials = None
#     if MAIL_USERNAME or MAIL_PASSWORD:
#         credentials = (MAIL_USERNAME, MAIL_PASSWORD)
#     mail_handler = SMTPHandler((MAIL_SERVER, MAIL_PORT), 'no-reply@' + MAIL_SERVER, ADMINS, 'www.daanlubbers.nl failure', credentials)<commit_msg>Now calling setup_module() functions in for loop<commit_after>from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from .navigation import MyNavigation as Navigation
from .navigation import NavBarItem as Item
from flaskext.markdown import Markdown

# Flask
app = Flask(__name__)
app.config.from_object('config')

# SQLAlchemy
db = SQLAlchemy(app)

# Flask-Markdown
Markdown(app)

# Flask-Navigation
nav = Navigation(app)
# Create main navigation bar and add Home button.
nav.Bar('base', [nav.Item('Home', 'index')])

# Setup modules
# The order of calling setup_module determines the order of the main navigation bar items.
nav_bar = nav['base']
import app.mod_projects as projects_module
import app.mod_streams as streams_module
import app.mod_adminpanel as adminpanel_module
import app.mod_auth as auth_module
import app.mod_todo as todo_module
modules = [projects_module, streams_module, adminpanel_module, auth_module, todo_module]
for module in modules:
    module.setup_module(app, nav_bar)

# Setup error handling
import logging

# if not app.debug:
#     # Via email
#     from logging.handlers import SMTPHandler
#     credentials = None
#     if MAIL_USERNAME or MAIL_PASSWORD:
#         credentials = (MAIL_USERNAME, MAIL_PASSWORD)
#     mail_handler = SMTPHandler((MAIL_SERVER, MAIL_PORT), 'no-reply@' + MAIL_SERVER, ADMINS, 'www.daanlubbers.nl failure', credentials)
{'fraction_non_alphanumeric': 0.08134141990724224, 'fraction_numerical': 0.0, 'mean_word_length': 5.4907407407407405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2077213', 'n_tokens_mistral': 887, 'n_tokens_neox': 873, 'n_words': 261}