#NEWLINE# def list_directory( path , ignore_directories , ignore_extensions ) : #NEWLINE# #INDENT# for ( root , dirs , files ) in os . walk ( path ) : #NEWLINE# #INDENT# for dir in ignore_directories : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# dirs . remove ( dir ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# ( yield root ) #NEWLINE# for file in files : #NEWLINE# #INDENT# ( _ , ext ) = os . path . splitext ( file ) #NEWLINE# if ( ext in ignore_extensions ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ( yield os . path . join ( root , file ) )