#NEWLINE# def read_list( self ) : #NEWLINE# #INDENT# if ( not os . path . exists ( self . list_file ) ) : #NEWLINE# #INDENT# self . regex_list = [ ] #NEWLINE# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# mtime = os . path . getmtime ( self . list_file ) #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# log . err ( ( 'Failed to get mtime of %s' % self . list_file ) ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( mtime <= self . rules_last_read ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# new_regex_list = [ ] #NEWLINE# for line in open ( self . list_file ) : #NEWLINE# #INDENT# pattern = line . strip ( ) #NEWLINE# if ( line . startswith ( '#' ) or ( not pattern ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# new_regex_list . append ( re . compile ( pattern ) ) #NEWLINE# #UNINDENT# except re . error : #NEWLINE# #INDENT# log . err ( ( "Failed to parse '%s' in '%s'. Ignoring line" % ( pattern , self . list_file ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . regex_list = new_regex_list #NEWLINE# self . rules_last_read = mtime