#NEWLINE# def _setup_attrs( self , data , kws ) : #NEWLINE# #INDENT# 'Handle overridden attributes and initialize them with data.\n\n        Makes sure that all attributes have access to the data\n        source, which is used for mapping attributes to groups\n        of data.\n\n        Returns:\n            None\n\n        ' #NEWLINE# source = ColumnDataSource ( data . df ) #NEWLINE# attr_names = self . default_attributes . keys ( ) #NEWLINE# custom_palette = kws . get ( 'palette' ) #NEWLINE# attributes = dict ( ) #NEWLINE# for attr_name in attr_names : #NEWLINE# #INDENT# attr = kws . pop ( attr_name , None ) #NEWLINE# if isinstance ( attr , AttrSpec ) : #NEWLINE# #INDENT# attributes [ attr_name ] = attr #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( attr , str ) or isinstance ( attr , list ) ) : #NEWLINE# #INDENT# attributes [ attr_name ] = self . default_attributes [ attr_name ] . _clone ( ) #NEWLINE# if isinstance ( attributes [ attr_name ] , ColorAttr ) : #NEWLINE# #INDENT# if ( custom_palette is not None ) : #NEWLINE# #INDENT# attributes [ attr_name ] . iterable = custom_palette #NEWLINE# #UNINDENT# #UNINDENT# attributes [ attr_name ] . setup ( data = source , columns = attr ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( self . default_attributes [ attr_name ] , ColorAttr ) and ( custom_palette is not None ) ) : #NEWLINE# #INDENT# attributes [ attr_name ] = self . default_attributes [ attr_name ] . _clone ( ) #NEWLINE# attributes [ attr_name ] . iterable = custom_palette #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# attributes [ attr_name ] = self . default_attributes [ attr_name ] . _clone ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for attr_name in attr_names : #NEWLINE# #INDENT# attributes [ attr_name ] . update_data ( data = source ) #NEWLINE# #UNINDENT# return attributes