def parse_into_dict(cls, stateful_measure): """Parse and return a dictionary for a stateful measure""" stateful_measure_dict = {} if stateful_measure.get_name() is not None: stateful_measure_dict['name'] = stateful_measure.get_Name() if stateful_measure.get_has_changed() is not None: stateful_measure_dict['has_changed'] = stateful_measure.get_has_changed() if stateful_measure.get_Description() is not None: stateful_measure_dict['description'] = structured_text.parse_into_dict(stateful_measure.get_Description()) if stateful_measure.get_Object() is not None: stateful_measure_dict['object'] = cybox_object.parse_into_dict(stateful_measure.get_Object()) return stateful_measure_dict
def parse_into_dict(cls, observable): """Parse the observable into a dictionary-esque representation""" observable_dict = {} if observable.get_id() is not None: observable_dict['id'] = observable.get_id() if observable.get_idref() is not None: observable_dict['idref'] = observable.get_idref() if observable.get_Title() is not None: observable_dict['title'] = observable.get_Title() if observable.get_Description() is not None: observable_dict['description'] = structured_text.parse_into_dict(observable.get_Description()) if observable.get_Stateful_Measure() is not None: observable_dict['stateful_measure'] = stateful_measure.parse_into_dict(observable.get_Stateful_Measure()) #TODO - add rest of observable components return observable_dict
def parse_into_dict(cls, stateful_measure): """Parse and return a dictionary for a stateful measure""" stateful_measure_dict = {} if stateful_measure.get_name() is not None: stateful_measure_dict['name'] = stateful_measure.get_Name() if stateful_measure.get_has_changed() is not None: stateful_measure_dict[ 'has_changed'] = stateful_measure.get_has_changed() if stateful_measure.get_Description() is not None: stateful_measure_dict[ 'description'] = structured_text.parse_into_dict( stateful_measure.get_Description()) if stateful_measure.get_Object() is not None: stateful_measure_dict['object'] = cybox_object.parse_into_dict( stateful_measure.get_Object()) return stateful_measure_dict