Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # compile regexps
- compile_tuple = ('match', 'test')
- reg_count = 0
- for reg in regs:
- for key in compile_tuple:
- if key in reg:
- try:
- reg[key] = re.compile(reg[key])
- except re.error as e:
- print(("\t[Error] regs[%d]%s:\n" +
- "\t Unable to compile %r:\n" +
- "\t [Errstr]: %s\n" +
- "\t Removing...")
- % (reg_count
- , 'match' in reg
- and (
- isinstance(reg['match'], str)
- and " = `%s`" % reg['match']
- or " = `%s`" % reg['match'].pattern
- ) or ''
- , key
- , e)
- )
- regs.remove(reg)
- reg_count_removed += 1
- reg_count += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement