def matchrules(thing, rules, is_modqueue=False):
    if thing.name in SEEN and not is_modqueue:
        return False
    if thing.name in MODQUEUE_ACTED and is_modqueue:
        return False

    vg = ValueGetter()
    for rule in rules:
        logging.debug("Match %s against %s" % (thing.name, rule['_filename']))
        ruleMatches = True
        matches = {}
        for key, value in sorted(rule.iteritems(), rulesorter):
            if key in ('actions', '_filename'):
                continue

            # Allow to make negative matches by prefixing with "!"
            invert = key[0] == "!"

            try:
                if invert:
                    fieldvalue = unicode(getattr(vg, key[1:])(thing))
                else:
                    fieldvalue = unicode(getattr(vg, key)(thing))
            except AttributeError:
                # Ignore conditions we don't understand
                continue
            except TypeError:
                ruleMatches = False
                break

            logging.debug((thing.name, key, fieldvalue) % "Match %s %s %s")
            regex = '(?P<full>%s)' % value
            m = re.search(regex, fieldvalue, flags=re.IGNORECASE)

            if (not m and not invert) or (m and invert):
                ruleMatches = False
                break
            elif m:
                matches[key] = m.groupdict()
        if ruleMatches:
            try:
                decorate(thing)
                applyrule(thing, rule, matches)
                seen(thing.name)
                if is_modqueue:
                    modqueue_acted(thing.name)
                return True
            except Exception, e:
                logging.error(str(e))
                return False
    seen(thing.name)
    return False
dataset/ETHPy150Open rasher/reddit-modbot/modbot.py/matchrules/swapped operands of `%`