Show More
@@ -317,6 +317,22 b' checks = [' | |||||
317 | ('txt', r'.*\.txt$', txtfilters, txtpats), |
|
317 | ('txt', r'.*\.txt$', txtfilters, txtpats), | |
318 | ] |
|
318 | ] | |
319 |
|
319 | |||
|
320 | def _preparepats(): | |||
|
321 | for c in checks: | |||
|
322 | failandwarn = c[-1] | |||
|
323 | for pats in failandwarn: | |||
|
324 | for i, pseq in enumerate(pats): | |||
|
325 | # fix-up regexes for multi-line searches | |||
|
326 | po = p = pseq[0] | |||
|
327 | # \s doesn't match \n | |||
|
328 | p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p) | |||
|
329 | # [^...] doesn't match newline | |||
|
330 | p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p) | |||
|
331 | ||||
|
332 | #print po, '=>', p | |||
|
333 | pats[i] = (p,) + pseq[1:] | |||
|
334 | _preparepats() | |||
|
335 | ||||
320 | class norepeatlogger(object): |
|
336 | class norepeatlogger(object): | |
321 | def __init__(self): |
|
337 | def __init__(self): | |
322 | self._lastseen = None |
|
338 | self._lastseen = None | |
@@ -403,15 +419,6 b' def checkfile(f, logfunc=_defaultlogger.' | |||||
403 | p, msg = pat |
|
419 | p, msg = pat | |
404 | ignore = None |
|
420 | ignore = None | |
405 |
|
421 | |||
406 | # fix-up regexes for multi-line searches |
|
|||
407 | po = p |
|
|||
408 | # \s doesn't match \n |
|
|||
409 | p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p) |
|
|||
410 | # [^...] doesn't match newline |
|
|||
411 | p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p) |
|
|||
412 |
|
||||
413 | #print po, '=>', p |
|
|||
414 |
|
||||
415 | pos = 0 |
|
422 | pos = 0 | |
416 | n = 0 |
|
423 | n = 0 | |
417 | for m in re.finditer(p, post, re.MULTILINE): |
|
424 | for m in re.finditer(p, post, re.MULTILINE): |
General Comments 0
You need to be logged in to leave comments.
Login now