def match_rules(self, rules):
        """Process this transaction against the given ruleset

        Returns a dict of fields with ScoreSet values, which may be empty.
        Notably, the rule processing will be shortcircuited if the Xn is
        already complete - in this case, None is returned.
        """
        try:
            self.check()
            return None
        except XnDataError:
            pass

        scores = {}

        for r in rules:
            outcomes = r.match(self)
            if not outcomes:
                continue
            for outcome in outcomes:
                if isinstance(outcome, rule.SourceOutcome):
                    key = 'src'
                elif isinstance(outcome, rule.DestinationOutcome):
                    key = 'dst'
                elif isinstance(outcome, rule.DescriptionOutcome):
                    key = 'desc'
                elif isinstance(outcome, rule.DropOutcome):
                    key = 'drop'
                elif isinstance(outcome, rule.RebateOutcome):
                    key = 'rebate'
                else:
                    raise KeyError
                if key not in scores:
                    scores[key] = score.ScoreSet()  # initialise ScoreSet
                scores[key].append((outcome.value, outcome.score))

        return scores
def match_rules ( self , rules ) : try : self . check ( ) return None except XnDataError : pass scores = { } for r in rules : outcomes = r . match ( self ) if not outcomes : continue for outcome in outcomes : if isinstance ( outcome , rule . SourceOutcome ) : key = 'src' elif isinstance ( outcome , rule . DestinationOutcome ) : key = 'dst' elif isinstance ( outcome , rule . DescriptionOutcome ) : key = 'desc' elif isinstance ( outcome , rule . DropOutcome ) : key = 'drop' elif isinstance ( outcome , rule . RebateOutcome ) : key = 'rebate' else : raise KeyError if key not in scores : scores [ key ] = score . ScoreSet ( ) scores [ key ] . append ( ( outcome . value , outcome . score ) ) return scores
Process this transaction against the given ruleset

        Returns a dict of fields with ScoreSet values, which may be empty.
        Notably, the rule processing will be shortcircuited if the Xn is
        already complete - in this case, None is returned.