def _process_tools_arg(plot, tools):
 tool_objs = []
 tool_map = {}
 temp_tool_str = ''
 repeated_tools = []
 if isinstance(tools, (list, tuple)):
  for tool in tools:
   if isinstance(tool, Tool):
    tool_objs.append(tool)
   elif isinstance(tool, string_types):
    temp_tool_str += (tool + ',')
   else:
    raise ValueError('tool should be a string or an instance of Tool class')
  tools = temp_tool_str
 for tool in re.split('\\s*,\\s*', tools.strip()):
  if (tool == ''):
   continue
  tool_obj = _tool_from_string(tool)
  tool_objs.append(tool_obj)
  tool_map[tool] = tool_obj
 for (typename, group) in itertools.groupby(sorted([tool.__class__.__name__ for tool in tool_objs])):
  if (len(list(group)) > 1):
   repeated_tools.append(typename)
 if repeated_tools:
  warnings.warn(('%s are being repeated' % ','.join(repeated_tools)))
 return (tool_objs, tool_map)

def _process_tools_arg ( plot , tools ) : tool_objs = [ ] tool_map = { } temp_tool_str = '' repeated_tools = [ ] if isinstance ( tools , ( list , tuple ) ) : for tool in tools : if isinstance ( tool , Tool ) : tool_objs . append ( tool ) elif isinstance ( tool , string_types ) : temp_tool_str += ( tool + ',' ) else : raise ValueError ( 'tool should be a string or an instance of Tool class' ) tools = temp_tool_str for tool in re . split ( '\\s*,\\s*' , tools . strip ( ) ) : if ( tool == '' ) : continue tool_obj = _tool_from_string ( tool ) tool_objs . append ( tool_obj ) tool_map [ tool ] = tool_obj for ( typename , group ) in itertools . groupby ( sorted ( [ tool . __class__ . __name__ for tool in tool_objs ] ) ) : if ( len ( list ( group ) ) > 1 ) : repeated_tools . append ( typename ) if repeated_tools : warnings . warn ( ( '%s are being repeated' % ',' . join ( repeated_tools ) ) ) return ( tool_objs , tool_map )
adds tools to the plot object args: plot : instance of a plot object tools : list of tool types or string listing the tool names .