Mercurial > hg-stable
changeset 19308:84faaacbd3fa
check-code: compile all patterns on initialisation
They where compiled once for every checked file (when calling finditer).
author | Simon Heimberg <simohe@besonet.ch> |
---|---|
date | Sat, 08 Jun 2013 20:20:14 +0200 |
parents | 5443d40d524b |
children | 7d77fa1cd537 |
files | contrib/check-code.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Sat Jun 08 20:20:14 2013 +0200 +++ b/contrib/check-code.py Sat Jun 08 20:20:14 2013 +0200 @@ -330,7 +330,7 @@ p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p) #print po, '=>', p - pats[i] = (p,) + pseq[1:] + pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:] _preparepats() class norepeatlogger(object): @@ -421,7 +421,7 @@ pos = 0 n = 0 - for m in re.finditer(p, post, re.MULTILINE): + for m in p.finditer(post): if prelines is None: prelines = pre.splitlines() postlines = post.splitlines(True)