<commit_before><commit_msg>script added to delete pandora videos<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,triple_collection
###################################################################################################################################################################################

class Command(BaseCommand):

    help = " This script will delete the pandora videos from 'home' group "

    def handle(self, *args, **options):
        

        pandora_video_st = node_collection.one({'_type': 'GSystemType','name': 'Pandora_video'})
        source_id_at=node_collection.one({'$and':[{'name':'source_id'},{'_type':'AttributeType'}]})

        if pandora_video_st and source_id_at:

            member_set=node_collection.find({'$and':[{'member_of': {'$all': [ObjectId(pandora_video_st._id)]}}, {'_type':'File'}]})
            gattribute=triple_collection.find({'_type':'GAttribute', 'attribute_type.$id':source_id_at._id })
            for each in member_set: 
                each.delete()
                print "Video ",each.name," removed from member_of successfully !!\n"

            for each in gattribute:
                each.delete()
                print "Video ",each.name," removed from attribute_set successfully !!\n"
                

{'fraction_non_alphanumeric': 0.2193146417445483, 'fraction_numerical': 0.0, 'mean_word_length': 4.0344827586206895, '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': '6817722', 'n_tokens_mistral': 429, 'n_tokens_neox': 408, 'n_words': 98}