<commit_before>from os import getenv
from os import listdir
from os import path

from flask_babel import lazy_gettext as _

app_basedir = path.abspath(path.dirname(__file__))


def ui(key):
    return {
        'logout': _('Logout'),
        'login': _('Login'),
        'register': _('Register'),
        'sync': _('Sync now!'),
        'home': _('Home'),
        'about': _('About'),
        'email': _('Email'),
        'email_new': _('Write new'),
        'email_inbox': _('Inbox'),
        'email_sent': _('Sent'),
        'email_outbox': _('Outbox'),
    }.get(key)


class Config(object):
    DEFAULT_TRANSLATION = 'en'
    TRANSLATIONS_PATH = path.join(app_basedir, 'opwen_webapp', 'translations')
    TRANSLATIONS = frozenset(listdir(TRANSLATIONS_PATH) + [DEFAULT_TRANSLATION])

    TESTING = False

    ADMIN_ROLE = 'admininstrator'
    ADMIN_NAME = 'opwen-administrator'
    ADMIN_PASSWORD = '<PASSWORD>: <PASSWORD>!'

    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + path.join(app_basedir, 'opwen.db')
    SQLALCHEMY_MIGRATE_REPO = path.join(app_basedir, 'db_repository')
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    UPLOAD_DIRECTORY = path.join(app_basedir, 'attachments')
    UPLOAD_ENDPOINT = 'attachments'

    EMAILS_PER_PAGE = 20

    CLIENT_NAME = getenv('OPWEN_CLIENT_NAME')

    INTERNET_INTERFACE_NAME = getenv('OPWEN_INTERNET_INTERFACE_NAME')
    REMOTE_SYNC_SCHEDULED_HOUR_UTC = '1'
    REMOTE_STORAGE_ACCOUNT_NAME = getenv('OPWEN_REMOTE_ACCOUNT_NAME')
    REMOTE_STORAGE_ACCOUNT_KEY = getenv('OPWEN_REMOTE_ACCOUNT_KEY')
    REMOTE_STORAGE_CONTAINER = 'opwen'
    REMOTE_UPLOAD_PATH = '%s/from_opwen/new' % CLIENT_NAME
    REMOTE_UPLOAD_FILENAME_FORMAT = '%Y-%m-%d_%H-%M.zip'
    REMOTE_DOWNLOAD_PATH = '%s/to_opwen/new.zip' % CLIENT_NAME
    REMOTE_SERIALIZER_EMAILS_NAME = 'emails.jsonl'
    REMOTE_SERIALIZER_ACCOUNTS_NAME = 'accounts.jsonl'
    REMOTE_SERIALIZER_ATTACHMENTS_NAME = 'attachments'

    MAX_CONTENT_LENGTH = 0.5 * 1024 * 1024
    SECRET_KEY = getenv('OPWEN_SECRET_KEY')

    SECURITY_USER_IDENTITY_ATTRIBUTES = ('name', 'email')
    SECURITY_PASSWORD_HASH = '<PASSWORD>'
    SECURITY_PASSWORD_SALT = getenv('OPWEN_PASSWORD_SALT')
    SECURITY_REGISTERABLE = True
    SECURITY_POST_REGISTER_VIEW = 'post_register'
    SECURITY_POST_LOGIN_VIEW = 'post_login'
    SECURITY_POST_LOGOUT_VIEW = 'post_logout'<commit_msg>Move database and attachments to state directory<commit_after>from os import getenv
from os import listdir
from os import path

from flask_babel import lazy_gettext as _

app_basedir = path.abspath(path.dirname(__file__))
state_basedir = path.abspath(getenv('OPWEN_STATE_DIRECTORY', app_basedir))


def ui(key):
    return {
        'logout': _('Logout'),
        'login': _('Login'),
        'register': _('Register'),
        'sync': _('Sync now!'),
        'home': _('Home'),
        'about': _('About'),
        'email': _('Email'),
        'email_new': _('Write new'),
        'email_inbox': _('Inbox'),
        'email_sent': _('Sent'),
        'email_outbox': _('Outbox'),
    }.get(key)


class Config(object):
    DEFAULT_TRANSLATION = 'en'
    TRANSLATIONS_PATH = path.join(app_basedir, 'opwen_webapp', 'translations')
    TRANSLATIONS = frozenset(listdir(TRANSLATIONS_PATH) + [DEFAULT_TRANSLATION])

    TESTING = False

    ADMIN_ROLE = 'admininstrator'
    ADMIN_NAME = 'opwen-administrator'
    ADMIN_PASSWORD = '<PASSWORD>: <PASSWORD>!'

    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + path.join(state_basedir, 'opwen.db')
    SQLALCHEMY_MIGRATE_REPO = path.join(app_basedir, 'db_repository')
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    UPLOAD_DIRECTORY = path.join(state_basedir, 'attachments')
    UPLOAD_ENDPOINT = 'attachments'

    EMAILS_PER_PAGE = 20

    CLIENT_NAME = getenv('OPWEN_CLIENT_NAME')

    INTERNET_INTERFACE_NAME = getenv('OPWEN_INTERNET_INTERFACE_NAME')
    REMOTE_SYNC_SCHEDULED_HOUR_UTC = '1'
    REMOTE_STORAGE_ACCOUNT_NAME = getenv('OPWEN_REMOTE_ACCOUNT_NAME')
    REMOTE_STORAGE_ACCOUNT_KEY = getenv('OPWEN_REMOTE_ACCOUNT_KEY')
    REMOTE_STORAGE_CONTAINER = 'opwen'
    REMOTE_UPLOAD_PATH = '%s/from_opwen/new' % CLIENT_NAME
    REMOTE_UPLOAD_FILENAME_FORMAT = '%Y-%m-%d_%H-%M.zip'
    REMOTE_DOWNLOAD_PATH = '%s/to_opwen/new.zip' % CLIENT_NAME
    REMOTE_SERIALIZER_EMAILS_NAME = 'emails.jsonl'
    REMOTE_SERIALIZER_ACCOUNTS_NAME = 'accounts.jsonl'
    REMOTE_SERIALIZER_ATTACHMENTS_NAME = 'attachments'

    MAX_CONTENT_LENGTH = 0.5 * 1024 * 1024
    SECRET_KEY = getenv('OPWEN_SECRET_KEY')

    SECURITY_USER_IDENTITY_ATTRIBUTES = ('name', 'email')
    SECURITY_PASSWORD_HASH = '<PASSWORD>'
    SECURITY_PASSWORD_SALT = getenv('OPWEN_PASSWORD_SALT')
    SECURITY_REGISTERABLE = True
    SECURITY_POST_REGISTER_VIEW = 'post_register'
    SECURITY_POST_LOGIN_VIEW = 'post_login'
    SECURITY_POST_LOGOUT_VIEW = 'post_logout'
{'fraction_non_alphanumeric': 0.11919568822553897, 'fraction_numerical': 0.00538971807628524, 'mean_word_length': 4.37305122494432, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7333378', 'n_tokens_mistral': 1947, 'n_tokens_neox': 1825, 'n_words': 268}