#NEWLINE# def get_all_re( gitignore_path_list ) : #NEWLINE# #INDENT# 'Get all compiled regular expression from gitignore_list\n\n    :param gitignore_path_list: list of str -- the path of all `.gitignore`\n    :return: dict -- the absolute path of `.gitignore` is the key,\n                     the value in dict is another dict, like\n                     result[path of `.gitignore`][key2]:\n                        result[path][1]: list of hash to match\n                        result[path][2]: list of negate ignore path to match\n                        result[path][3]: list of ignore path to match\n    ' #NEWLINE# result = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for gitignore_path in gitignore_path_list : #NEWLINE# #INDENT# with open ( gitignore_path , 'r' ) as gitignore_file : #NEWLINE# #INDENT# result [ gitignore_path ] = { #NEWLINE# #INDENT# 1 : [ ] , #NEWLINE# 2 : [ ] , #NEWLINE# 3 : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# for line in gitignore_file : #NEWLINE# #INDENT# ( ignore_type , ignore_pattern ) = get_re_from_single_line ( line ) #NEWLINE# if ignore_type : #NEWLINE# #INDENT# _re = re . compile ( ignore_pattern ) #NEWLINE# result [ gitignore_path ] [ ignore_type ] . append ( _re ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return result