#NEWLINE# def get_paths( root , exclude_patterns , include_patterns , has_exceptions = False ) : #NEWLINE# #INDENT# paths = [ ] #NEWLINE# for ( parent , dirs , files ) in os . walk ( root , topdown = True , followlinks = False ) : #NEWLINE# #INDENT# parent = os . path . relpath ( parent , root ) #NEWLINE# if ( parent == '.' ) : #NEWLINE# #INDENT# parent = '' #NEWLINE# #UNINDENT# if ( not has_exceptions ) : #NEWLINE# #INDENT# dirs [ : ] = [ d for d in dirs if should_include ( os . path . join ( parent , d ) , exclude_patterns , path ) ] #NEWLINE# #UNINDENT# for path in dirs : #NEWLINE# #INDENT# if should_include ( os . path . join ( parent , path ) , exclude_patterns , include_patterns ) : #NEWLINE# #INDENT# paths . append ( os . path . join ( parent , path ) ) #NEWLINE# #UNINDENT# #UNINDENT# for path in files : #NEWLINE# #INDENT# if should_include ( os . path . join ( parent , path ) , exclude_patterns , include_patterns ) : #NEWLINE# #INDENT# paths . append ( os . path . join ( parent , path ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return paths