def _apply_value_predicates(self, i, r,<EOL>summarize=False,<EOL>report_unexpected_exceptions=True,<EOL>context=None):
for field_name, predicate, code, message, modulus in self._value_predicates:<EOL><INDENT>if i % modulus == <NUM_LIT:0>: <EOL><INDENT>fi = self._field_names.index(field_name)<EOL>if fi < len(r): <EOL><INDENT>value = r[fi]<EOL>try:<EOL><INDENT>valid = predicate(value)<EOL>if not valid:<EOL><INDENT>p = {'<STR_LIT:code>': code}<EOL>if not summarize:<EOL><INDENT>p['<STR_LIT:message>'] = message<EOL>p['<STR_LIT>'] = i + <NUM_LIT:1><EOL>p['<STR_LIT>'] = fi + <NUM_LIT:1><EOL>p['<STR_LIT>'] = field_name<EOL>p['<STR_LIT:value>'] = value<EOL>p['<STR_LIT>'] = r<EOL>if context is not None: p['<STR_LIT>'] = context<EOL><DEDENT>yield p<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>if report_unexpected_exceptions:<EOL><INDENT>p = {'<STR_LIT:code>': UNEXPECTED_EXCEPTION}<EOL>if not summarize:<EOL><INDENT>p['<STR_LIT:message>'] = MESSAGES[UNEXPECTED_EXCEPTION] % (e.__class__.__name__, e)<EOL>p['<STR_LIT>'] = i + <NUM_LIT:1><EOL>p['<STR_LIT>'] = fi + <NUM_LIT:1><EOL>p['<STR_LIT>'] = field_name<EOL>p['<STR_LIT:value>'] = value<EOL>p['<STR_LIT>'] = r<EOL>p['<STR_LIT>'] = e<EOL>p['<STR_LIT>'] = '<STR_LIT>' % (predicate.__name__,<EOL>predicate.__doc__)<EOL>if context is not None: p['<STR_LIT>'] = context<EOL><DEDENT>yield p<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>
Apply value predicates on the given record `r`.