<commit_before>''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError

from django_mongokit import get_database

try:
    from bson import ObjectId
except ImportError:  # old pymongo
    from pymongo.objectid import ObjectId


''' imports from application folders/files '''
from gnowsys_ndf.ndf.models import GSystemType
from gnowsys_ndf.ndf.models import GSystem

from gnowsys_ndf.settings import GAPPS

####################################################################################################################

class Command(BaseCommand):
    help = "Based on GAPPS list, inserts few documents (consisting of dummy values) into the following collections:\n\n" \
           "\tGSystemType, GSystemType"

    def handle(self, *args, **options):
        db = get_database()

        db.drop_collection(GSystem.collection_name)
        db.drop_collection(GSystemType.collection_name)
        
        gst_collection = db[GSystemType.collection_name]
        gst_node = []

        for i in range(0, len(GAPPS)):
            gst_node.append(gst_collection.GSystemType())
            
            gst_node[i].name = unicode(GAPPS[i])
            gst_node[i].save()

        # --- End of handle() ---<commit_msg>minor changes in filldb.py<commit_after>''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError

from django_mongokit import get_database

try:
    from bson import ObjectId
except ImportError:  # old pymongo
    from pymongo.objectid import ObjectId


''' imports from application folders/files '''
from gnowsys_ndf.ndf.models import GSystemType
from gnowsys_ndf.ndf.models import GSystem

from gnowsys_ndf.settings import GAPPS

####################################################################################################################

class Command(BaseCommand):
    help = "Based on GAPPS list, inserts few documents (consisting of dummy values) into the following collections:\n\n" \
           "\tGSystemType, GSystemType"

    def handle(self, *args, **options):
        db = get_database()

        db.drop_collection(GSystem.collection_name)
        db.drop_collection(GSystemType.collection_name)
        
        gst_collection = db[GSystemType.collection_name]
        gst_node = []
        user_id = 1 
        for i in range(0, len(GAPPS)):
            gst_node.append(gst_collection.GSystemType())
            
            gst_node[i].name = unicode(GAPPS[i])
            gst_node[i].created_by = user_id
            gst_node[i].modified_by.append(user_id)
            gst_node[i].save()

        # --- End of handle() ---
{'fraction_non_alphanumeric': 0.17104276069017255, 'fraction_numerical': 0.0011252813203300824, 'mean_word_length': 3.364975450081833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3105664', 'n_tokens_mistral': 766, 'n_tokens_neox': 741, 'n_words': 180}