Accepts a list of fixers and returns a dictionary
        of head node type --> fixer list.
430692
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)
        else:
            if 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.itervalues(),
                           pygram.python_grammar.tokens):
        head_nodes[node_type].extend(every)
    return dict(head_nodes)
377535
def merge(self, *others):
        '''
        
        '''
        new_pileups = {}
        for collection in (self,) + others:
            for (locus, pileup) in collection.pileups.items():
                if locus in new_pileups:
                    new_pileups[locus].update(pileup)
                else:
                    new_pileups[locus] = Pileup(locus, pileup.elements)
        return PileupCollection(new_pileups, parent=self)
11872
def fixup_parse_tree(cls_node):
    
    for node in cls_node.children:
        if node.type == syms.suite:
            # already in the preferred format, do nothing
            return

    # !%@#! oneliners have no suite node, we have to fake one up
    for i, node in enumerate(cls_node.children):
        if node.type == token.COLON:
            break
    else:
        raise ValueError("No class suite and no ':'!")

    # move everything into a suite node
    suite = Node(syms.suite, [])
    while cls_node.children[i+1:]:
        move_node = cls_node.children[i+1]
        suite.append_child(move_node.clone())
        move_node.remove()
    cls_node.append_child(suite)
    node = suite
778825
def fix_deplist(deps):
    
    deps = [
        ((dep.lower(),)
         if not isinstance(dep, (list, tuple))
         else tuple([dep_entry.lower()
                     for dep_entry in dep
                    ]))
        for dep in deps
    ]
    return deps
1061671
def getRequiredNodes(self):
        
        return {nodeShape:len(self.nodeReservations[nodeShape]) for nodeShape in self.nodeShapes}
1016174
def get_lib2to3_fixers():
    ''''''
    fixers = []
    fixer_dirname = fixer_dir.__path__[0]
    for name in sorted(os.listdir(fixer_dirname)):
        if name.startswith("fix_") and name.endswith(".py"):
            fixers.append("lib2to3.fixes." + name[:-3])
    return fixers
873706
def remove_dups(head):
    
    hashset = set()
    prev = Node()
    while head:
        if head.val in hashset:
            prev.next = head.next
        else:
            hashset.add(head.val)
            prev = head
        head = head.next
431053
def _headers(self, headers_dict):
        
        return Headers(dict((k,[v]) for (k,v) in headers_dict.items()))
111098
def addrs2managers(addrs):
    '''
    '''
    mgrs = {}
    for addr in addrs:
        mgr_addr = get_manager(addr)
        if mgr_addr not in mgrs:
            mgrs[mgr_addr] = []
        mgrs[mgr_addr].append(addr)
    return mgrs
698250
def get_changes(self, fixer=str.lower,
                    task_handle=taskhandle.NullTaskHandle()):
        
        stack = changestack.ChangeStack(self.project, 'Fixing module names')
        jobset = task_handle.create_jobset('Fixing module names',
                                           self._count_fixes(fixer) + 1)
        try:
            while True:
                for resource in self._tobe_fixed(fixer):
                    jobset.started_job(resource.path)
                    renamer = rename.Rename(self.project, resource)
                    changes = renamer.get_changes(fixer(self._name(resource)))
                    stack.push(changes)
                    jobset.finished_job()
                    break
                else:
                    break
        finally:
            jobset.started_job('Reverting to original state')
            stack.pop_all()
            jobset.finished_job()
        return stack.merged()
1045883
def heads(resolve, verbose):
    
    alembic_command.heads(
        config=get_config(),
        verbose=verbose,
        resolve_dependencies=resolve
    )
941787
def get_tree_members(self):
        

        members = []
        queue = deque()
        queue.appendleft(self)
        visited = set()

        while len(queue):
            node = queue.popleft()

            if node not in visited:
                members.extend(node.get_member_info())
                queue.extendleft(node.get_children())
                visited.add(node)

        return [{attribute: member.get(attribute) for attribute in self.attr_list} for member in members if member]
181805
def refitNodes(self):
        
        for n in self.branch:
            if n.prefix is not None:
                ns = n.namespace()
                if self.permit(ns):
                    n.prefix = self.prefixes[ns[1]]
            self.refitAttrs(n)
1139817
def with_headers(self, headers=None, **params):
                
        if isinstance(headers, (tuple, list)):
            headers = dict(headers)

        if params:
            if isinstance(headers, dict):
                headers.update(params)
            elif headers is None:
                headers = params

        self._headers.update(headers)
        return self
95697
def refactor(source, fixer_names, ignore=None, filename=''):
    
    check_lib2to3()
    from lib2to3 import pgen2
    try:
        new_text = refactor_with_2to3(source,
                                      fixer_names=fixer_names,
                                      filename=filename)
    except (pgen2.parse.ParseError,
            SyntaxError,
            UnicodeDecodeError,
            UnicodeEncodeError):
        return source

    if ignore:
        if ignore in new_text and ignore not in source:
            return source

    return new_text
257945
def owned_objects(self):
        
        return (
            [
                self,
                self.__dict__,
                self._head,
                self._tail,
                self._out_edges,
                self._out_edges._keys,
                self._out_edges._values,
                self._in_edges,
                self._in_edges._keys,
                self._in_edges._values,
                self._vertices,
                self._vertices._elements,
                self._edges,
            ] +
            list(six.itervalues(self._out_edges)) +
            list(six.itervalues(self._in_edges))
        )
282144
def peers(self):
        ""
        return [addr for (addr, peer) in self._dispatcher.peers.items()
                if peer.up]