#NEWLINE# def _append_config( mappings , analysis , doc_type , type_mappings , type_analysis ) : #NEWLINE# #INDENT# '\n    Append config for the named type to pre-existing config.\n\n    This function takes a mappings dict and an analysis dict which may contain\n    prior data, and attempts to update them with mappings and analysis settings\n    for the named type.\n    ' #NEWLINE# mappings . update ( { #NEWLINE# #INDENT# doc_type : type_mappings , #NEWLINE# #UNINDENT# } ) #NEWLINE# for ( section , items ) in type_analysis . items ( ) : #NEWLINE# #INDENT# existing_items = analysis . setdefault ( section , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for name in items : #NEWLINE# #INDENT# if ( name in section ) : #NEWLINE# #INDENT# fmt = "Duplicate definition of 'index.analysis.{}.{}'." #NEWLINE# msg = fmt . format ( section , name ) #NEWLINE# raise RuntimeError ( msg ) #NEWLINE# #UNINDENT# #UNINDENT# existing_items . update ( items )