<commit_before># -*- coding: utf-8; Mode: Python -*-
#
# Copyright (C) 2010  <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""Integra todos os modulos flask declarados noutros lugares.

Esses `outros' modulos são registrados numa aplicação flask. Essa nova
aplicação pode ser usada pelo executável `cdcp', que chama o método
`.run()' da aplicação ou pelo mod_wsgi no apache.
"""

from flask import Flask, send_from_directory
from jinja2 import FileSystemLoader
from app.usuarios import module as usuarios
import config
import os

class WebApp(Flask):
    """Flask extention to retrieve static files from a configurable
    place
    """

    def __init__(self, import_name, static_path=None, media_path=None):
        self.media_path = media_path
        super(WebApp, self).__init__(import_name, static_path)

    @property
    def has_static_folder(self):
        """This is `True` if self.media_path var exists or if the
        package bound object's container has a folder named
        ``'static'``.
        """
        return os.path.isdir(self.media_path) or \
            os.path.isdir(os.path.join(self.root_path, 'static'))

    def send_static_file(self, filename):
        """Function used internally to send static files from the static
        folder to the browser.

        This method is overriden to be able to customize the
        filesystem path exposed.
        """
        path = os.path.join(self.root_path, 'static')
        if self.media_path:
            path = os.path.abspath(self.media_path)
        return send_from_directory(path, filename)

def create_app():
    """Constroi a aplicação flask e registra outros modulos nela.
    """
    app = WebApp(__name__, media_path=config.STATIC_DIR)
    app.jinja_env.loader = FileSystemLoader(config.TEMPLATE_DIR)
    app.register_module(usuarios, url_prefix="/usuarios/")
    return app<commit_msg>Removendo imports relativos pra deixar o pylint mais feliz :)<commit_after># -*- coding: utf-8; Mode: Python -*-
#
# Copyright (C) 2010  <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""Integra todos os modulos flask declarados noutros lugares.

Esses `outros' modulos são registrados numa aplicação flask. Essa nova
aplicação pode ser usada pelo executável `cdcp', que chama o método
`.run()' da aplicação ou pelo mod_wsgi no apache.
"""

from flask import Flask, send_from_directory
from jinja2 import FileSystemLoader
from .app.usuarios import module as usuarios
from .config import STATIC_DIR, TEMPLATE_DIR
import os

class WebApp(Flask):
    """Flask extention to retrieve static files from a configurable
    place
    """

    def __init__(self, import_name, static_path=None, media_path=None):
        self.media_path = media_path
        super(WebApp, self).__init__(import_name, static_path)

    @property
    def has_static_folder(self):
        """This is `True` if self.media_path var exists or if the
        package bound object's container has a folder named
        ``'static'``.
        """
        return os.path.isdir(self.media_path) or \
            os.path.isdir(os.path.join(self.root_path, 'static'))

    def send_static_file(self, filename):
        """Function used internally to send static files from the static
        folder to the browser.

        This method is overriden to be able to customize the
        filesystem path exposed.
        """
        path = os.path.join(self.root_path, 'static')
        if self.media_path:
            path = os.path.abspath(self.media_path)
        return send_from_directory(path, filename)

def create_app():
    """Constroi a aplicação flask e registra outros modulos nela.
    """
    app = WebApp(__name__, media_path=STATIC_DIR)
    app.jinja_env.loader = FileSystemLoader(TEMPLATE_DIR)
    app.register_module(usuarios, url_prefix="/usuarios/")
    return app
{'fraction_non_alphanumeric': 0.08300473186119874, 'fraction_numerical': 0.0027602523659305996, 'mean_word_length': 3.4460999123575813, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4279663', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1451, 'n_words': 565}