

def find_action(self, rules, filename):
    'Given a list of rules and a filename to match against them, returns\n        an action stored in one of those rules. The action returned corresponds\n        to the first rule that matches the filename given.\n\n        Args:\n            rules: A list of tuples, where each tuple is (filename pattern,\n                action).\n            filename: A filename to match against the filename regex patterns.\n\n        Returns:\n            An action corresponding to the first rule that matches the filename\n            given. If no rules match, returns None.\n        '
    for (filename_pattern, action) in rules:
        if re.match(filename_pattern, filename):
            return action
    return None

dataset/ETHPy150Open dropbox/emmer/emmer/response_router.py ResponseRouter.find_action/original