#NEWLINE# def source_directory_path( self ) : #NEWLINE# #INDENT# '\n        Path to the directory where source strings are stored.\n\n        Paths are identified using a scoring system; more likely\n        directory names get higher scores, as do directories with\n        formats that only used for source strings.\n        ' #NEWLINE# possible_sources = [ ] #NEWLINE# for ( root , dirnames , filenames ) in os . walk ( self . checkout_path ) : #NEWLINE# #INDENT# for dirname in dirnames : #NEWLINE# #INDENT# if ( dirname in self . SOURCE_DIR_NAMES ) : #NEWLINE# #INDENT# score = self . SOURCE_DIR_SCORES [ dirname ] #NEWLINE# directory_path = os . path . join ( root , dirname ) #NEWLINE# if directory_contains_resources ( directory_path ) : #NEWLINE# #INDENT# if directory_contains_resources ( directory_path , source_only = True ) : #NEWLINE# #INDENT# score += 3 #NEWLINE# #UNINDENT# possible_sources . append ( ( directory_path , score ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if possible_sources : #NEWLINE# #INDENT# return max ( possible_sources , key = ( lambda s : s [ 1 ] ) ) [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise MissingSourceDirectoryError ( 'No source directory found for project {0}' . format ( self . db_project . slug ) )