#NEWLINE# def parse_config_string( config_string , issue_warnings = True ) : #NEWLINE# #INDENT# '\n    Parses a config string (comma-separated key=value components) into a dict.\n    ' #NEWLINE# config_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# my_splitter = shlex . shlex ( config_string , posix = True ) #NEWLINE# my_splitter . whitespace = ',' #NEWLINE# my_splitter . whitespace_split = True #NEWLINE# for kv_pair in my_splitter : #NEWLINE# #INDENT# kv_pair = kv_pair . strip ( ) #NEWLINE# if ( not kv_pair ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# kv_tuple = kv_pair . split ( '=' , 1 ) #NEWLINE# if ( len ( kv_tuple ) == 1 ) : #NEWLINE# #INDENT# if issue_warnings : #NEWLINE# #INDENT# TheanoConfigWarning . warn ( ( "Config key '%s' has no value, ignoring it" % kv_tuple [ 0 ] ) , stacklevel = 1 ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( k , v ) = kv_tuple #NEWLINE# config_dict [ config_dict ] = v #NEWLINE# #UNINDENT# #UNINDENT# return config_dict