parameters: (self, recurse=False)
docstring: If this PBXGroup has only one child and it's also a PBXGroup, take
      it over by making all of its children this object's children.
  
      This function will continue to take over only children when those children
      are groups.  If there are three PBXGroups representing a, b, and c, with
      c inside b and b inside a, and a and b have no other children, this will
      result in a taking over both b and c, forming a PBXGroup for a/b/c.
  
      If recurse is True, this function will recurse into children and ask them
      to collapse themselves by taking over only children as well.  Assuming
      an example hierarchy with files at a/b/c/d1, a/b/c/d2, and a/b/c/d3/e/f
      (d1, d2, and f are files, the rest are groups), recursion will result in
      a group for a/b/c containing a group for d3/e.
docstring_summary: If this PBXGroup has only one child and it's also a PBXGroup, take
      it over by making all of its children this object's children.
docstring_tokens: If this PBXGroup has only one child and it s also a PBXGroup take it over by making all of its children this object s children .
function: def TakeOverOnlyChild(self, recurse=False):
      """If this PBXGroup has only one child and it's also a PBXGroup, take
      it over by making all of its children this object's children.
  
      This function will continue to take over only children when those children
      are groups.  If there are three PBXGroups representing a, b, and c, with
      c inside b and b inside a, and a and b have no other children, this will
      result in a taking over both b and c, forming a PBXGroup for a/b/c.
  
      If recurse is True, this function will recurse into children and ask them
      to collapse themselves by taking over only children as well.  Assuming
      an example hierarchy with files at a/b/c/d1, a/b/c/d2, and a/b/c/d3/e/f
      (d1, d2, and f are files, the rest are groups), recursion will result in
      a group for a/b/c containing a group for d3/e.
      """
  
      # At this stage, check that child class types are PBXGroup exactly,
      # instead of using isinstance.  The only subclass of PBXGroup,
      # PBXVariantGroup, should not participate in reparenting in the same way:
      # reparenting by merging different object types would be wrong.
      while len(self._properties['children']) == 1 and \
            self._properties['children'][0].__class__ == PBXGroup:
        # Loop to take over the innermost only-child group possible.
  
        child = self._properties['children'][0]
  
        # Assume the child's properties, including its children.  Save a copy
        # of this object's old properties, because they'll still be needed.
        # This object retains its existing id and parent attributes.
        old_properties = self._properties
        self._properties = child._properties
        self._children_by_path = child._children_by_path
  
        if not 'sourceTree' in self._properties or \
           self._properties['sourceTree'] == '<group>':
          # The child was relative to its parent.  Fix up the path.  Note that
          # children with a sourceTree other than "<group>" are not relative to
          # their parents, so no path fix-up is needed in that case.
          if 'path' in old_properties:
            if 'path' in self._properties:
              # Both the original parent and child have paths set.
              self._properties['path'] = posixpath.join(old_properties['path'],
                                                        self._properties['path'])
            else:
              # Only the original parent has a path, use it.
              self._properties['path'] = old_properties['path']
          if 'sourceTree' in old_properties:
            # The original parent had a sourceTree set, use it.
            self._properties['sourceTree'] = old_properties['sourceTree']
  
        # If the original parent had a name set, keep using it.  If the original
        # parent didn't have a name but the child did, let the child's name
        # live on.  If the name attribute seems unnecessary now, get rid of it.
        if 'name' in old_properties and old_properties['name'] != None and \
           old_properties['name'] != self.Name():
          self._properties['name'] = old_properties['name']
        if 'name' in self._properties and 'path' in self._properties and \
           self._properties['name'] == self._properties['path']:
          del self._properties['name']
  
        # Notify all children of their new parent.
        for child in self._properties['children']:
          child.parent = self
  
      # If asked to recurse, recurse.
      if recurse:
        for child in self._properties['children']:
          if child.__class__ == PBXGroup:
            child.TakeOverOnlyChild(recurse)
function_tokens: def TakeOverOnlyChild ( self , recurse = False ) : # At this stage, check that child class types are PBXGroup exactly, # instead of using isinstance.  The only subclass of PBXGroup, # PBXVariantGroup, should not participate in reparenting in the same way: # reparenting by merging different object types would be wrong. while len ( self . _properties [ 'children' ] ) == 1 and self . _properties [ 'children' ] [ 0 ] . __class__ == PBXGroup : # Loop to take over the innermost only-child group possible. child = self . _properties [ 'children' ] [ 0 ] # Assume the child's properties, including its children.  Save a copy # of this object's old properties, because they'll still be needed. # This object retains its existing id and parent attributes. old_properties = self . _properties self . _properties = child . _properties self . _children_by_path = child . _children_by_path if not 'sourceTree' in self . _properties or self . _properties [ 'sourceTree' ] == '<group>' : # The child was relative to its parent.  Fix up the path.  Note that # children with a sourceTree other than "<group>" are not relative to # their parents, so no path fix-up is needed in that case. if 'path' in old_properties : if 'path' in self . _properties : # Both the original parent and child have paths set. self . _properties [ 'path' ] = posixpath . join ( old_properties [ 'path' ] , self . _properties [ 'path' ] ) else : # Only the original parent has a path, use it. self . _properties [ 'path' ] = old_properties [ 'path' ] if 'sourceTree' in old_properties : # The original parent had a sourceTree set, use it. self . _properties [ 'sourceTree' ] = old_properties [ 'sourceTree' ] # If the original parent had a name set, keep using it.  If the original # parent didn't have a name but the child did, let the child's name # live on.  If the name attribute seems unnecessary now, get rid of it. if 'name' in old_properties and old_properties [ 'name' ] != None and old_properties [ 'name' ] != self . Name ( ) : self . _properties [ 'name' ] = old_properties [ 'name' ] if 'name' in self . _properties and 'path' in self . _properties and self . _properties [ 'name' ] == self . _properties [ 'path' ] : del self . _properties [ 'name' ] # Notify all children of their new parent. for child in self . _properties [ 'children' ] : child . parent = self # If asked to recurse, recurse. if recurse : for child in self . _properties [ 'children' ] : if child . __class__ == PBXGroup : child . TakeOverOnlyChild ( recurse )