#NEWLINE# def get_role( object_name , attribute , value = None , parent_object_names = ( ) ) : #NEWLINE# #INDENT# "\n    Values have types associated with them based on graph_reference.\n\n    'data' type values are always kept\n    'style' values are kept if they're sequences (but not strings)\n\n    :param (str) object_name: The name of the object containing 'attribute'.\n    :param (str) attribute: The attribute we want the `role` of.\n    :param (*) value: If the value is an array, the return can be different.\n    :param parent_object_names: An iterable of obj names from graph reference.\n    :returns: (str) This will be 'data', 'style', or 'info'.\n\n    " #NEWLINE# if ( ( object_name in TRACE_NAMES ) and ( attribute == 'type' ) ) : #NEWLINE# #INDENT# return 'info' #NEWLINE# #UNINDENT# attributes_dicts = get_attributes_dicts ( object_name , parent_object_names ) #NEWLINE# matches = [ ] #NEWLINE# for attributes_dict in attributes_dicts . values ( ) : #NEWLINE# #INDENT# for ( key , val ) in attributes_dict . items ( ) : #NEWLINE# #INDENT# if ( key == attribute ) : #NEWLINE# #INDENT# matches . append ( val ) #NEWLINE# #UNINDENT# #UNINDENT# for ( key , val ) in attributes_dict . get ( '_deprecated' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . items ( ) : #NEWLINE# #INDENT# if ( key == attribute ) : #NEWLINE# #INDENT# matches . append ( val ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# roles = [ ] #NEWLINE# for match in matches : #NEWLINE# #INDENT# role = match [ 'role' ] #NEWLINE# array_ok = match . get ( 'arrayOk' ) #NEWLINE# if ( ( value is not None ) and array_ok ) : #NEWLINE# #INDENT# iterable = hasattr ( value , '__iter__' ) #NEWLINE# stringy = isinstance ( value , six . string_types ) #NEWLINE# dicty = isinstance ( value , dict ) #NEWLINE# if ( iterable and ( not stringy ) and ( not val ) ) : #NEWLINE# #INDENT# role = 'data' #NEWLINE# #UNINDENT# #UNINDENT# roles . append ( role ) #NEWLINE# #UNINDENT# if ( 'data' in roles ) : #NEWLINE# #INDENT# role = 'data' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# role = roles [ 0 ] #NEWLINE# #UNINDENT# return role