def _get_headnode_dict(fixer_list):
 head_nodes = collections.defaultdict(list)
 every = []
 for fixer in fixer_list:
  if fixer.pattern:
   try:
    heads = _get_head_types(fixer.pattern)
   except _EveryNode:
    every.append(fixer)
   else:
    for node_type in heads:
     head_nodes[node_type].append(fixer)
  elif (fixer._accept_type is not None):
   head_nodes[fixer._accept_type].append(fixer)
  else:
   every.append(fixer)
 for node_type in chain(pygram.python_grammar.symbol2number.values(), pygram.python_grammar.tokens):
  head_nodes[node_type].extend(every)
 return dict(head_nodes)

def _get_headnode_dict ( fixer_list ) : head_nodes = collections . defaultdict ( list ) every = [ ] for fixer in fixer_list : if fixer . pattern : try : heads = _get_head_types ( fixer . pattern ) except _EveryNode : every . append ( fixer ) else : for node_type in heads : head_nodes [ node_type ] . append ( fixer ) elif ( fixer . _accept_type is not None ) : head_nodes [ fixer . _accept_type ] . append ( fixer ) else : every . append ( fixer ) for node_type in chain ( pygram . python_grammar . symbol2number . values ( ) , pygram . python_grammar . tokens ) : head_nodes [ node_type ] . extend ( every ) return dict ( head_nodes )
accepts a list of fixers and returns a dictionary of head node type --> fixer list .