def __init__(self): event_regex = {} regex_filepath = ( os.path.dirname(os.path.abspath(__file__)) + "/" + self.REGEX_FILE ) self.event_regex = self._load_regex_yaml(regex_filepath) EventParser.__init__(self, event_regex.keys(), self.EVENT_NAME)
def __init__(self, interested_eventcodes=None): event_regex = {} regex_filepath = (os.path.dirname(os.path.abspath(__file__)) + "/" + self.REGEX_FILE) self.interested_eventcodes = interested_eventcodes self.event_regex = self._load_regex_yaml(regex_filepath) EventParser.__init__(self, self.get_columns(), self.EVENT_NAME)
def _load_regex_yaml(self, yaml_file): event_regex = EventParser._load_regex_yaml(self, yaml_file) if self.interested_eventcodes is not None: for eventcode in self.interested_eventcodes: required_event_regex = {} if eventcode not in event_regex: raise KeyError( "Regex for eventcode %s is not available in the config file. Please choose from %s" % (eventcode, list(event_regex.keys()))) required_event_regex[eventcode] = event_regex[eventcode] return required_event_regex return event_regex