def look_for_events(lconnections, orcbot): """ Looks for new data in all connections Arguments: host, connectxions """ while 1: time.sleep(1) if(lconnections): #goes through connections and calls ircParse's process_data #on them, returning an Event object, or None events = map(lambda x:parse.process_data(x, orcbot), lconnections.items()) print events #filters out the None's, in other words the ones without new data events = filter(lambda x:x!=None, events) if(events): for socket_events in events: for socket_event in socket_events: socket_event.apply_handler() orcbot_events = parse.process_data((orcbot, None), orcbot) if orcbot_events: for orcbot_event in orcbot_events: orcbot_event.apply_handler()
def run(self): """ Arguments: - `self`: """ while 1: time.sleep(1) #goes through connections and calls ircParse's #on them, returning an Event object, or None if(CONNECTIONS): event_list = map(lambda x:parse.process_data(x, None), CONNECTIONS.items()) event_list = filter(lambda x:x!=None, event_list) for events in event_list: for event in events: event.apply_handler()