parameters: (node)
docstring: For each sub node, we call recursively this function.
docstring_summary: For each sub node, we call recursively this function.
docstring_tokens: For each sub node we call recursively this function .
function: def CleanupVcproj(node):
    """For each sub node, we call recursively this function."""
    for sub_node in node.childNodes:
      AbsoluteNode(sub_node)
      CleanupVcproj(sub_node)
  
    # Normalize the node, and remove all extranous whitespaces.
    for sub_node in node.childNodes:
      if sub_node.nodeType == Node.TEXT_NODE:
        sub_node.data = sub_node.data.replace("\r", "")
        sub_node.data = sub_node.data.replace("\n", "")
        sub_node.data = sub_node.data.rstrip()
  
    # Fix all the semicolon separated attributes to be sorted, and we also
    # remove the dups.
    if node.attributes:
      for (name, value) in node.attributes.items():
        sorted_list = sorted(value.split(';'))
        unique_list = []
        for i in sorted_list:
          if not unique_list.count(i):
            unique_list.append(i)
        node.setAttribute(name, ';'.join(unique_list))
        if not value:
          node.removeAttribute(name)
  
    if node.childNodes:
      node.normalize()
  
    # For each node, take a copy, and remove it from the list.
    node_array = []
    while node.childNodes and node.childNodes[0]:
      # Take a copy of the node and remove it from the list.
      current = node.childNodes[0]
      node.removeChild(current)
  
      # If the child is a filter, we want to append all its children
      # to this same list.
      if current.nodeName == 'Filter':
        node_array.extend(FlattenFilter(current))
      else:
        node_array.append(current)
  
  
    # Sort the list.
    node_array.sort(CmpNode())
  
    # Insert the nodes in the correct order.
    for new_node in node_array:
      # But don't append empty tool node.
      if new_node.nodeName == 'Tool':
        if new_node.attributes and new_node.attributes.length == 1:
          # This one was empty.
          continue
      if new_node.nodeName == 'UserMacro':
        continue
      node.appendChild(new_node)
function_tokens: def CleanupVcproj ( node ) : for sub_node in node . childNodes : AbsoluteNode ( sub_node ) CleanupVcproj ( sub_node ) # Normalize the node, and remove all extranous whitespaces. for sub_node in node . childNodes : if sub_node . nodeType == Node . TEXT_NODE : sub_node . data = sub_node . data . replace ( "\r" , "" ) sub_node . data = sub_node . data . replace ( "\n" , "" ) sub_node . data = sub_node . data . rstrip ( ) # Fix all the semicolon separated attributes to be sorted, and we also # remove the dups. if node . attributes : for ( name , value ) in node . attributes . items ( ) : sorted_list = sorted ( value . split ( ';' ) ) unique_list = [ ] for i in sorted_list : if not unique_list . count ( i ) : unique_list . append ( i ) node . setAttribute ( name , ';' . join ( unique_list ) ) if not value : node . removeAttribute ( name ) if node . childNodes : node . normalize ( ) # For each node, take a copy, and remove it from the list. node_array = [ ] while node . childNodes and node . childNodes [ 0 ] : # Take a copy of the node and remove it from the list. current = node . childNodes [ 0 ] node . removeChild ( current ) # If the child is a filter, we want to append all its children # to this same list. if current . nodeName == 'Filter' : node_array . extend ( FlattenFilter ( current ) ) else : node_array . append ( current ) # Sort the list. node_array . sort ( CmpNode ( ) ) # Insert the nodes in the correct order. for new_node in node_array : # But don't append empty tool node. if new_node . nodeName == 'Tool' : if new_node . attributes and new_node . attributes . length == 1 : # This one was empty. continue if new_node . nodeName == 'UserMacro' : continue node . appendChild ( new_node )