#NEWLINE# def parse( fp ) : #NEWLINE# #INDENT# '\n    :param str fp: File pointer\n    :rtype dict:\n    :returns: \n    ' #NEWLINE# tempcolors = [ ] #NEWLINE# index = 0 #NEWLINE# configdata = csv . reader ( fp , delimiter = ',' ) #NEWLINE# for row in configdata : #NEWLINE# #INDENT# if ( index > 0 ) : #NEWLINE# #INDENT# tempcolors . append ( [ int ( row [ 0 ] ) , int ( row [ 1 ] ) , int ( row [ 2 ] ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# brightness = int ( row [ 0 ] ) #NEWLINE# contrast = int ( row [ 1 ] ) #NEWLINE# thresholdblack = int ( row [ 2 ] ) #NEWLINE# thresholdwhite = int ( row [ 3 ] ) #NEWLINE# #UNINDENT# index = ( index + 1 ) #NEWLINE# #UNINDENT# if ( len ( tempcolors ) > 2 ) : #NEWLINE# #INDENT# basecolors = tempcolors #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'basecolors' : basecolors , #NEWLINE# 'brightness' : brightness , #NEWLINE# 'contrast' : contrast , #NEWLINE# 'thresholdblack' : thresholdblack , #NEWLINE# 'thresholdwhite' : thresholdwhite , #NEWLINE# #UNINDENT# }