<commit_before># -*- coding: utf-8 -*-
"""
    init.py
    ~~~~~~
    Implements several functions to populate the database startup Bombolone.
    
    
    :copyright: (c) 2012 by <NAME>
    :license: BSD (See LICENSE for details)
"""
from shared import db


def clean_database():
    """ Removes all the collections in the database. """
    db.languages.remove()
    db.pages.remove()
    db.users.remove()


def init_languages():
    """ Initializes the base 8 languages, 
    and in any language is written the name of the other.
    """
    
    dict_languages = {
        'it' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'en' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'es' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'pt' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'fr' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'de' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'jp' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'cn' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'ru' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'tr' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        }
    }
    
    # Insert the languages dictionaries 
    for lan in dict_languages:
        db.languages.insert( { 'code' : lan, 'value' : dict_languages[lan] })


def init_mongodb():
    """ Initialize the database MongoDB of Bombolone. """
    init_languages()


def init_mongodb_two():
    """ fixtures MongoDB
    """    
    admin_pass = <PASSWORD>_password('<PASSWORD>')
    user_pass = create_password('<PASSWORD>')
    
    db.users.update( { 'username' : 'admin' }, { 'username' : 'admin', 'password' : <PASSWORD>, 'rank' : 10 }, True)
    db.users.update( { 'username' : 'user' }, { 'username' : 'user', 'password' : <PASSWORD>, 'rank' : 20 }, True)
    
    for num in range(1,6):
        page = {
            'name' : 'page_'+str(num),<commit_msg>Added the init_users() that initializes the base two users<commit_after># -*- coding: utf-8 -*-
"""
    init.py
    ~~~~~~
    Implements several functions to populate the database startup Bombolone.
    
    
    :copyright: (c) 2012 by <NAME>
    :license: BSD (See LICENSE for details)
"""
from shared import db


def clean_database():
    """ Removes all the collections in the database. """
    db.languages.remove()
    db.pages.remove()
    db.users.remove()


def init_languages():
    """ Initializes the base 8 languages, 
    and in any language is written the name of the other.
    """
    
    dict_languages = {
        'it' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'en' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'es' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'pt' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'fr' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'de' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'jp' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'cn' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'ru' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        },
        'tr' : {
            'it' : 'Italiano',
            'en' : '',
            'pt' : '',
            'fr' : '',
            'de' : '',
            'jp' : '',
            'cn' : '',
            'ru' : '',
            'tr' : ''
        }
    }
    
    # Insert the languages dictionaries 
    for lan in dict_languages:
        db.languages.insert( { 'code' : lan, 'value' : dict_languages[lan] })


def init_users():
    """ Initializes the base two users: Admin and Users """
    
    list_users = [
        {
            'username' : 'admin', 
            'password' : create_password('<PASSWORD>'), # Create passwords in md5 and sha1
            'rank' : 10 
        },
        {
            'username' : 'admin', 
            'password' : create_password('<PASSWORD>'), 
            'rank' : 10 
        }
    ]
    
    # Insert the users list 
    for user in dict_languages:
        db.users.insert( user )
        

def init_mongodb():
    """ Initialize the database MongoDB of Bombolone. """
    init_languages()
    init_users()


def init_mongodb_two():
    """ fixtures MongoDB
    """   
    for num in range(1,6):
        page = {
            'name' : 'page_'+str(num),
{'fraction_non_alphanumeric': 0.20294535589717091, 'fraction_numerical': 0.003358739180984369, 'mean_word_length': 0.955050505050505, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '6209543', 'n_tokens_mistral': 2494, 'n_tokens_neox': 2396, 'n_words': 475}