<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 Node
###################################################################################################################################################################################
collection = get_database()[Node.collection_name]
gapp_GST = collection.Node.one({'_type': 'MetaType', 'name': 'GAPP'})    

class Command(BaseCommand):

    help = "This script will create a Term app"

    def handle(self, *args, **options):
        
        term = collection.Node.one({'_type': 'GSystemType', 'name': 'Term', 'member_of': ObjectId(gapp_GST._id) })
        if not term:
            term = collection.Node.one()
            term = collection.GSystemType()
            term.name = u"Term"
            term.access_policy = u"PUBLIC"
            term.contributors.append(1)
            term.created_by = int(1)
            term.modified_by = int(1)
            term.status = u"PUBLISHED"
            term.member_of.append(gapp_GST._id)
            term.meta_type_set.append(gapp_GST)
            term.save()
            print "'Term' app successfully created ! !"
        else:
            print "'Term' app already available"<commit_msg>script added for creating term app<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 Node
###################################################################################################################################################################################
collection = get_database()[Node.collection_name]
gapp_GST = collection.Node.one({'_type': 'MetaType', 'name': 'GAPP'})    

class Command(BaseCommand):

    help = "This script will create a Term app"

    def handle(self, *args, **options):
        
        term = collection.Node.one({'_type': 'GSystemType', 'name': 'Term', 'member_of': ObjectId(gapp_GST._id) })
        if not term:
            term = collection.GSystemType()
            term.name = u"Term"
            term.access_policy = u"PUBLIC"
            term.contributors.append(1)
            term.created_by = int(1)
            term.modified_by = int(1)
            term.status = u"PUBLISHED"
            term.member_of.append(gapp_GST._id)
            term.meta_type_set.append(gapp_GST)
            term.save()
            print "'Term' app successfully created ! !"
        else:
            print "'Term' app already available"
{'fraction_non_alphanumeric': 0.21702557200538358, 'fraction_numerical': 0.002018842530282638, 'mean_word_length': 3.217021276595745, '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': '5044334', 'n_tokens_mistral': 804, 'n_tokens_neox': 775, 'n_words': 192}