#NEWLINE# def process_braces( self , pattern , flags , i = 0 ) : #NEWLINE# #INDENT# should_escape = ( ( flags & FNM_NOESCAPE ) == 0 ) #NEWLINE# patterns = [ ] #NEWLINE# escaped = False #NEWLINE# pattern_start = i #NEWLINE# segments = [ '' ] #NEWLINE# while ( i < len ( pattern ) ) : #NEWLINE# #INDENT# ch = pattern [ i ] #NEWLINE# if ( ( ch == '\\' ) and should_escape and ( not escaped ) ) : #NEWLINE# #INDENT# escaped = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch == ',' ) : #NEWLINE# #INDENT# if escaped : #NEWLINE# #INDENT# escaped = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# suffix = pattern [ pattern_start : i ] #NEWLINE# patterns . extend ( combine_segments ( segments , suffix ) ) #NEWLINE# segments = [ '' ] #NEWLINE# pattern_start = ( i + 1 ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch == '}' ) : #NEWLINE# #INDENT# if escaped : #NEWLINE# #INDENT# escaped = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# suffix = pattern [ pattern_start : i ] #NEWLINE# patterns . extend ( combine_segments ( segments , suffix ) ) #NEWLINE# return ( i , patterns ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ch == '{' ) : #NEWLINE# #INDENT# if escaped : #NEWLINE# #INDENT# escaped = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# suffix = pattern [ pattern_start : i ] #NEWLINE# ( i , new_segs ) = self . process_braces ( pattern , flags , ( i + 1 ) ) #NEWLINE# segments = combine_segments ( segments , suffix , new_segs ) #NEWLINE# pattern_start = ( i + 1 ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# escaped = False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# i += 1 #NEWLINE# #UNINDENT# suffix = pattern [ pattern_start : ] #NEWLINE# patterns . extend ( combine_segments ( segments , suffix ) ) #NEWLINE# return ( i , self )