def create(self,configfile): Config.load_config(configfile) sortedEvents = SortedRawAwareEvents() sortedEvents.get_events_from_SQLite() #sortedEvents.get_events_from_MySQL() print "sorted" parser = Parser() result = list() temp_learning_element = LearningSetElement() i =0 for event in sortedEvents: learning_element = temp_learning_element.clone2() parsed_events = parser.parse_event(event) if self.filter_out(parsed_events): continue UpdateElement.update(learning_element,parsed_events) result.append(learning_element) temp_learning_element = learning_element i += 1 percent = float(i)/len(sortedEvents)*100 sys.stdout.write('%s percent \r' %( percent )) sys.stdout.flush() return result
def test_update_element(self): le1 = LearningSetElement() parsed_event = dict() parsed_event[Network]="WIFI" UpdateElement.update(le1, parsed_event) self.assertEqual("WIFI" in Network.values_set, True)