# HG changeset patch # User Simon Heimberg # Date 1370715614 -7200 # Node ID 5443d40d524b41d1e3ef63973806260e1e97ffbe # Parent 59cdd3a7e2817b8518415058549549a0706c63bb check-code: only fix patterns once The patterns were fixed once for every file. Now only do it once when loading the file. diff -r 59cdd3a7e281 -r 5443d40d524b contrib/check-code.py --- a/contrib/check-code.py Fri Jun 07 16:59:59 2013 -0500 +++ b/contrib/check-code.py Sat Jun 08 20:20:14 2013 +0200 @@ -317,6 +317,22 @@ ('txt', r'.*\.txt$', txtfilters, txtpats), ] +def _preparepats(): + for c in checks: + failandwarn = c[-1] + for pats in failandwarn: + for i, pseq in enumerate(pats): + # fix-up regexes for multi-line searches + po = p = pseq[0] + # \s doesn't match \n + p = re.sub(r'(?', p + pats[i] = (p,) + pseq[1:] +_preparepats() + class norepeatlogger(object): def __init__(self): self._lastseen = None @@ -403,15 +419,6 @@ p, msg = pat ignore = None - # fix-up regexes for multi-line searches - po = p - # \s doesn't match \n - p = re.sub(r'(?', p - pos = 0 n = 0 for m in re.finditer(p, post, re.MULTILINE):