throw away all node attributes, except for 'label
187413
def _preprocess_nodes_for_pydot(nodes_with_data):
    """'"""
    for (node_id, attrs) in nodes_with_data:
        if 'label' in attrs:
            yield (quote_for_pydot(node_id),
                   {'label': quote_for_pydot(attrs['label'])})
        else:
            yield (quote_for_pydot(node_id), {})
1156998
def purge_collection(keys):
    ""
    for key in keys:
        m = re.match(r'(.*) \((\d+)\)', key)
        name = m.group(1)
        node_id = m.group(2)
        value = render_value_for_node(node_id)
        print 'remove node with name:{0} and id:{1}'.format(name, node_id)

        delete_node(node_id=node_id)
        if isinstance(value, dict):
            purge_collection(value.keys())
226833
def clean_conditionally(node):
    """"""
    if node.tag not in ('form', 'table', 'ul', 'div', 'p'):
        return  # this is not the tag we are looking for

    weight = get_class_weight(node)
    # content_score = LOOK up the content score for this node we found
    # before else default to 0
    content_score = 0

    if weight + content_score < 0:
        logger.debug('Dropping conditional node')
        logger.debug('Weight + score < 0')
        return True

    commas_count = node.text_content().count(',')
    if commas_count < 10:
        logger.debug(
            "There are %d commas so we're processing more.", commas_count)

        # If there are not very many commas, and the number of
        # non-paragraph elements is more than paragraphs or other ominous
        # signs, remove the element.
        p = len(node.findall('.//p'))
        img = len(node.findall('.//img'))
        li = len(node.findall('.//li')) - 100
        inputs = len(node.findall('.//input'))

        embed = 0
        embeds = node.findall('.//embed')
        for e in embeds:
            if ok_embedded_video(e):
                embed += 1
        link_density = get_link_density(node)
        content_length = len(node.text_content())

        remove_node = False

        if li > p and node.tag != 'ul' and node.tag != 'ol':
            logger.debug('Conditional drop: li > p and not ul/ol')
            remove_node = True
        elif inputs > p / 3.0:
            logger.debug('Conditional drop: inputs > p/3.0')
            remove_node = True
        elif content_length < 25 and (img == 0 or img > 2):
            logger.debug('Conditional drop: len < 25 and 0/>2 images')
            remove_node = True
        elif weight < 25 and link_density > 0.2:
            logger.debug('Conditional drop: weight small (%f) and link is dense (%f)', weight, link_density)
            remove_node = True
        elif weight >= 25 and link_density > 0.5:
            logger.debug('Conditional drop: weight big but link heavy')
            remove_node = True
        elif (embed == 1 and content_length < 75) or embed > 1:
            logger.debug(
                'Conditional drop: embed w/o much content or many embed')
            remove_node = True

        if remove_node:
            logger.debug('Node will be removed: %s %r %s', node.tag, node.attrib, node.text_content()[:30])

        return remove_node

    return False
425960
def delete(self, *labels):
        '''

        '''
        deletes = []
        for label in labels:
            k1, k2 = self._keys_from_label(label)
            deletes.append(k1)
            deletes.append(k2)
        self.kvl.delete(self.TABLE, *deletes)
1047844
def suppress_deg_one_node(self, to_par_edge, nd_id, to_child_edge):
        """"""
        # circumvent the node with nd_id
        to_child_edge_id = to_child_edge['@id']
        par = to_par_edge['@source']
        self._edge_by_source[par][to_child_edge_id] = to_child_edge
        to_child_edge['@source'] = par
        # make it a tip...
        del self._edge_by_source[nd_id]
        # delete it
        self._del_tip(nd_id)
900765
def remove(self, name):
        
        attrs = [attr for attr in self.attributes if attr.name == name.strip()]
        if not attrs:
            raise ValueError(name)
        for attr in attrs:
            self.attributes.remove(attr)
391986
def removeAttribute(self, attrName):
        '''
            

        '''
        attrName = attrName.lower()

        # Delete provided attribute name ( #attrName ) from attributes map
        try:
            del self._attributes[attrName]
        except KeyError:
            pass
368363
def remove_attributes(self, model):
        
        for child in model.children():
            if 'nn.modules.container' in str(type(child)):
                self.remove_attributes(child)
            else:
                try:
                    del child.x
                except AttributeError:
                    pass
                try:
                    del child.y
                except AttributeError:
                    pass
1054699
function(nodes) {
      for (var i = 0, node; node = nodes[i]; i++)
        node.removeAttribute('_countedByPrototype');
      return nodes;
    }
397196
def remove_node(self, node):
        """"""
        try:
            self._nodes.remove(node)
            del self._weights[node]
        except (KeyError, ValueError):
            pass
        self._rebuild_circle()
1351356
def unnest(c, elem, ignore_whitespace=False):
        """"""
        parent = elem.getparent()
        gparent = parent.getparent()
        index = parent.index(elem)
        # put everything up to elem into a new parent element right before the current parent
        preparent = etree.Element(parent.tag)
        preparent.text, parent.text = (parent.text or ''), ''
        for k in parent.attrib.keys():
            preparent.set(k, parent.get(k))
        if index > 0:
            for ch in parent.getchildren()[:index]:
                preparent.append(ch)
        gparent.insert(gparent.index(parent), preparent)
        XML.remove_if_empty(preparent, leave_tail=True, ignore_whitespace=ignore_whitespace)
        # put the element right before the current parent
        XML.remove(elem, leave_tail=True)
        gparent.insert(gparent.index(parent), elem)
        elem.tail = ''
        # if the original parent is empty, remove it
        XML.remove_if_empty(parent, leave_tail=True, ignore_whitespace=ignore_whitespace)
924490
public void removeAttribute(CBORObject label) throws CoseException {
        if (objProtected.ContainsKey(label)) {
            if (rgbProtected != null) throw new CoseException("Operation would modify integrity protected attributes");
            objProtected.Remove(label);
        }
        if (objUnprotected.ContainsKey(label)) objUnprotected.Remove(label);
        if (objDontSend.ContainsKey(label)) objDontSend.Remove(label);
    }
61836
def remove_all_attributes(element, exclude=None):
    
    if exclude is None:
        exclude = []
    for k in element.attrib.keys():
        if k not in exclude:
            element.attrib.pop(k)
564268
def del_node(self, n):
        '''
        
        '''
        parent = self.get_node_attr(n, 'parent')
        if self.get_node_attr(n, 'direction') == 'R':
            self.set_node_attr(parent, 'Rchild', None)
        else:
            self.set_node_attr(parent, 'Lchild', None)
        Graph.del_node(self, n)
332091
def remove_all_labels(stdout=None):
    

    if not stdout:
        stdout = sys.stdout

    stdout.write("Droping constraints...\n")
    drop_constraints(quiet=False, stdout=stdout)

    stdout.write('Droping indexes...\n')
    drop_indexes(quiet=False, stdout=stdout)
515268
def removeIndexOnAttribute(self, attributeName):
        '''
            
        '''
        attributeName = attributeName.lower()
        if attributeName in self.otherAttributeIndexFunctions:
                del self.otherAttributeIndexFunctions[attributeName]
        if attributeName in self._otherAttributeIndexes:
                del self._otherAttributeIndexes[attributeName]
1011650
def remove_properties(self):
        
        node_prop = self.node.find('properties')
        if node_prop is not None:
            self.node.remove(node_prop)