<commit_before>#MAEC Malware Subject Class

#Copyright (c) 2013, The MITRE Corporation
#All rights reserved.

#Compatible with MAEC v3.0
#Last updated 4/10/2013

import maec.bindings.maec_package_1_0 as package_binding

class MalwareSubject(object):
    def __init__(self, id, generator, malware_instance_object = None):
        if id is not None:
            self.id = id
        elif generator is not None:
            self.generator = generator
            self.id = self.generator.generate_malware_subject_id()
        else:
            raise Exception("Must specify id or generator for MalwareSubject constructor")
        #Create the MAEC Subject object
        self.subject_obj = package_binding.MalwareSubjectType(id=self.generator.generate_malware_subject_id())
        #Set the Malware Instance Object Attributes (a CybOX object) if they are not none
        if malware_instance_object is not None:
            self.malware_instance_object = malware_instance_object
        self.field_data = None
        #Instantiate the lists
        self.analyses = []
        self.findings_bundles = []
        self.relationships = []
        #self.analyses = package_binding.AnalysisListType()
        #self.findings_bundles = package_binding.FindingsBundleListType()

    def to_obj(self):
        malware_subject_obj = package_binding.MalwareSubjectType(id = self.id)
        if self.malware_instance_object is not None: malware_subject_obj.set_Malware_Instance_Object_Attributes(self.malware_instance_object.to_obj())<commit_msg>A few bug fixes<commit_after>#MAEC Malware Subject Class

#Copyright (c) 2013, The MITRE Corporation
#All rights reserved.

#Compatible with MAEC v3.0
#Last updated 4/10/2013

import maec.bindings.maec_package_1_0 as package_binding

class MalwareSubject(object):
    def __init__(self, id, generator, malware_instance_object = None):
        if id is not None:
            self.id = id
        elif generator is not None:
            self.generator = generator
            self.id = self.generator.generate_malware_subject_id()
        else:
            raise Exception("Must specify id or generator for MalwareSubject constructor")
        #Create the MAEC Subject object
        self.subject_obj = package_binding.MalwareSubjectType(id=self.generator.generate_malware_subject_id())
        #Set the Malware Instance Object Attributes (a CybOX object) if they are not none
        self.malware_instance_object = malware_instance_object
        self.field_data = None
        #Instantiate the lists
        self.analyses = []
        self.findings_bundles = []
        self.relationships = []
        #self.analyses = package_binding.AnalysisListType()
        #self.findings_bundles = package_binding.FindingsBundleListType()

    def to_obj(self):
        malware_subject_obj = package_binding.MalwareSubjectType(id = self.id)
        if self.malware_instance_object is not None: malware_subject_obj.set_Malware_Instance_Object_Attributes(self.malware_instance_object.to_obj())
{'fraction_non_alphanumeric': 0.07009966777408638, 'fraction_numerical': 0.009966777408637873, 'mean_word_length': 3.30758226037196, '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': '3198949', 'n_tokens_mistral': 878, 'n_tokens_neox': 839, 'n_words': 215}