#NEWLINE# def refresh_file_mapping( self ) : #NEWLINE# #INDENT# '\n        Override the default refresh_file_mapping to look for nova files\n        recursively, rather than only in a top-level directory\n        ' #NEWLINE# self . suffix_map = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# suffix_order = [ ] #NEWLINE# suffix_order . append ( '.yaml' ) #NEWLINE# for ( suffix , mode , kind ) in imp . get_suffixes ( ) : #NEWLINE# #INDENT# self . suffix_map [ suffix ] = ( suffix , mode , kind ) #NEWLINE# suffix_order . append ( suffix ) #NEWLINE# #UNINDENT# self . file_mapping = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for mod_dir in self . module_dirs : #NEWLINE# #INDENT# for ( dirname , dirs , files ) in os . walk ( mod_dir ) : #NEWLINE# #INDENT# if ( '.git' in suffix_order ) : #NEWLINE# #INDENT# dirs . remove ( '.git' ) #NEWLINE# #UNINDENT# for filename in files : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if filename . startswith ( '_' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ( _ , ext ) = os . path . splitext ( filename ) #NEWLINE# fpath = os . path . join ( dirname , filename ) #NEWLINE# f_withext = fpath . partition ( mod_dir ) [ ( - 1 ) ] #NEWLINE# if ( ext not in [ '.py' , '.yaml' ] ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( f_withext in self . disabled ) : #NEWLINE# #INDENT# log . trace ( 'Skipping {0}, it is disabled by configuration' . format ( filename ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( f_withext not in self . file_mapping ) : #NEWLINE# #INDENT# self . file_mapping [ f_withext ] = ( fpath , ext ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# curr_ext = self . file_mapping [ f_withext ] [ 1 ] #NEWLINE# if ( curr_ext and ( suffix_order . index ( ext ) < suffix_order . index ( curr_ext ) ) ) : #NEWLINE# #INDENT# self . file_mapping [ f_withext ] = ( fpath , ext ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except OSError : #NEWLINE# #INDENT# continue